[pdfmod] Fix crash with export images by escaping output path
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pdfmod] Fix crash with export images by escaping output path
- Date: Fri, 27 Aug 2010 17:29:58 +0000 (UTC)
commit a5b03fed34500efa4b4ea8fccb6c2fa9a893237a
Author: Gabriel Burt <gabriel burt gmail com>
Date: Mon Aug 23 13:24:29 2010 -0500
Fix crash with export images by escaping output path
We export the images to a folder named after the document, but we need
to properly escape that name and the image output names themselves.
src/PdfMod/Gui/Actions.cs | 3 ++-
src/PdfMod/Pdf/Actions/ExportImagesAction.cs | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/PdfMod/Gui/Actions.cs b/src/PdfMod/Gui/Actions.cs
index 0f4020b..c934136 100644
--- a/src/PdfMod/Gui/Actions.cs
+++ b/src/PdfMod/Gui/Actions.cs
@@ -339,7 +339,8 @@ namespace PdfMod.Gui
Path.GetDirectoryName (app.Document.SuggestedSavePath),
// Translators: This is used for creating a folder name, be careful!
//String.Format (Catalog.GetString ("{0} - Images for {1}"), app.Document.Title ?? app.Document.Filename, GetPageSummary (pages, 10))
- app.Document.Title ?? System.IO.Path.GetFileNameWithoutExtension (app.Document.Filename)
+ Hyena.StringUtil.EscapeFilename (
+ app.Document.Title ?? System.IO.Path.GetFileNameWithoutExtension (app.Document.Filename))
);
var export_path = export_path_base;
diff --git a/src/PdfMod/Pdf/Actions/ExportImagesAction.cs b/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
index 2aa5516..31c1fd9 100644
--- a/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
+++ b/src/PdfMod/Pdf/Actions/ExportImagesAction.cs
@@ -122,8 +122,8 @@ namespace PdfMod.Pdf.Actions
var name_fragment = String.IsNullOrEmpty (name) ? null : String.Format (" ({0})", name);
var path = Path.Combine (
to_path,
- String.Format ("{0:00}{1}.{2}",
- image.PageIndex, name_fragment, ext)
+ Hyena.StringUtil.EscapeFilename (
+ String.Format ("{0:00}{1}.{2}", image.PageIndex, name_fragment, ext))
//String.Format ("Page {0} - #{1:00}{2}.{3}",
//image.Page.Index, image.PageIndex, name_fragment, ext)
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]