require Sesse::pr0n::Config_local;
};
- $VERSION = "v2.41";
+ $VERSION = "v2.49";
@ISA = qw(Exporter);
@EXPORT = qw(&error &dberror);
%EXPORT_TAGS = qw();
}
return $str;
}
+
+# This is not perfect (it can't handle "_ " right, for one), but it will do for now
+sub weird_space_encode {
+ my $val = shift;
+ if ($val =~ /_/) {
+ return "_" x (length($val) * 2);
+ } else {
+ return "_" x (length($val) * 2 - 1);
+ }
+}
+
+sub weird_space_unencode {
+ my $val = shift;
+ if (length($val) % 2 == 0) {
+ return "_" x (length($val) / 2);
+ } else {
+ return " " x ((length($val) + 1) / 2);
+ }
+}
sub pretty_escape {
my $value = shift;
+ $value =~ s/(([_ ])\2*)/weird_space_encode($1)/ge;
$value = URI::Escape::uri_escape($value);
-
- # Unescape a few for prettiness (we'll need something for a real _, though)
- $value =~ s/%20/_/g;
$value =~ s/%2F/\//g;
return $value;
my $value = shift;
# URI unescaping is already done for us
- $value =~ s/_/ /g;
+ $value =~ s/(_+)/weird_space_unencode($1)/ge;
return $value;
}
undef, $id)
or die "Couldn't delete old tag information in SQL: $!";
- my $q = $dbh->prepare('INSERT INTO tags (image,tag) VALUES (?,?)')
+ $q = $dbh->prepare('INSERT INTO tags (image,tag) VALUES (?,?)')
or die "Couldn't prepare inserting tag information: $!";
for my $tag (@tags) {
push @classic_fields, $info->{'ISOSetting'} . " ISO";
}
- if (defined($info->{'ExposureBiasValue'}) && $info->{'ExposureBiasValue'} != 0) {
+ if (defined($info->{'ExposureBiasValue'}) && $info->{'ExposureBiasValue'} ne "0") {
push @classic_fields, $info->{'ExposureBiasValue'} . " EV";
} elsif (defined($info->{'ExposureCompensation'}) && $info->{'ExposureCompensation'} != 0) {
push @classic_fields, $info->{'ExposureCompensation'} . " EV";