about summary refs log tree commit diff
path: root/pkgs/applications/graphics
diff options
context:
space:
mode:
authorFlorian Brandes <florian.brandes@posteo.de>2023-11-23 11:54:10 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-12-02 07:26:56 +0000
commit3ae1301d348f93b36bab16e3cd9aa1483dfff729 (patch)
tree4d87c7cf218b0dba46d81867c8ad2332510ae37b /pkgs/applications/graphics
parente970b0bc28f4ece416d6f775205724931819829d (diff)
gscan2pdf: patch from upstream with utf8 filenames
see: https://sourceforge.net/p/gscan2pdf/bugs/400

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
(cherry picked from commit d54a7a6019d30ecee3cbd363a99297b7f2bd00d7)
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r--pkgs/applications/graphics/gscan2pdf/default.nix2
-rw-r--r--pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch32
2 files changed, 34 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/gscan2pdf/default.nix b/pkgs/applications/graphics/gscan2pdf/default.nix
index 296d63cd6785a..0acc934a7fd9b 100644
--- a/pkgs/applications/graphics/gscan2pdf/default.nix
+++ b/pkgs/applications/graphics/gscan2pdf/default.nix
@@ -24,6 +24,8 @@ perlPackages.buildPerlPackage rec {
       url = "https://sourceforge.net/p/gscan2pdf/bugs/_discuss/thread/602a7cedfd/1ea4/attachment/0001-Remove-given-and-when-keywords-and-operator.patch";
       hash = "sha256-JtrHUkfEKnDhWfEVdIdYVlr5b/xChTzsrrPmruLaJ5M=";
     })
+    # fixes an error with utf8 file names. See https://sourceforge.net/p/gscan2pdf/bugs/400
+    ./image-utf8-fix.patch
   ];
 
   nativeBuildInputs = [ wrapGAppsHook ];
diff --git a/pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch b/pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch
new file mode 100644
index 0000000000000..fa1d03e0309a8
--- /dev/null
+++ b/pkgs/applications/graphics/gscan2pdf/image-utf8-fix.patch
@@ -0,0 +1,32 @@
+diff --git a/bin/gscan2pdf b/bin/gscan2pdf
+index e075b0f2..ff124522 100755
+--- a/bin/gscan2pdf
++++ b/bin/gscan2pdf
+@@ -3434,9 +3434,11 @@ sub save_image {
+         if ( @{$list_of_pages} > 1 ) {
+             my $w = length scalar @{$list_of_pages};
+             for ( 1 .. @{$list_of_pages} ) {
++                _utf8_on($filename);
+                 my $current_filename =
+                   sprintf "${filename}_%0${w}d.$SETTING{'image type'}",
+                   $_;
++                _utf8_off($filename);
+                 if ( -f $current_filename ) {
+                     my $text = sprintf __('This operation would overwrite %s'),
+                       $current_filename;
+@@ -3450,11 +3452,15 @@ sub save_image {
+                     return;
+                 }
+             }
++            _utf8_on($filename);
+             $filename = "${filename}_%0${w}d.$SETTING{'image type'}";
++            _utf8_off($filename);
+         }
+         else {
+             if ( $filename !~ /[.]$SETTING{'image type'}$/ixsm ) {
++                _utf8_on($filename);
+                 $filename = "$filename.$SETTING{'image type'}";
++                _utf8_off($filename);
+                 return if ( file_exists( $file_chooser, $filename ) );
+             }
+             return if ( file_writable( $file_chooser, $filename ) );