Title: [95607] trunk/Source/WebKit2
- Revision
- 95607
- Author
- mr...@apple.com
- Date
- 2011-09-21 03:16:53 -0700 (Wed, 21 Sep 2011)
Log Message
<rdar://problem/9890932> "Open PDF in Preview" on two PDFs of the same name does nothing the second time
The logic in PDFViewController::pathToPDFOnDisk that deals with constructing a unique
file name if a file of the suggested name already exists was incorrect. It was appending
the template used by mkstemps to the directory name component of the path rather than
using it as a prefix on the filename portion of the path. This resulted in a template path
like WebKitPDFs-ABCDEFXXXXXX-/foo.pdf where WebKitPDFs-ABCDEF/XXXXXX-foo.pdf was expected.
Reviewed by Jon Honeycutt.
* UIProcess/API/mac/PDFViewController.mm:
(WebKit::PDFViewController::pathToPDFOnDisk): Append the template as a new path component,
then append the suggested file name to that component.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (95606 => 95607)
--- trunk/Source/WebKit2/ChangeLog 2011-09-21 09:49:41 UTC (rev 95606)
+++ trunk/Source/WebKit2/ChangeLog 2011-09-21 10:16:53 UTC (rev 95607)
@@ -1,3 +1,19 @@
+2011-09-21 Mark Rowe <mr...@apple.com>
+
+ <rdar://problem/9890932> "Open PDF in Preview" on two PDFs of the same name does nothing the second time
+
+ The logic in PDFViewController::pathToPDFOnDisk that deals with constructing a unique
+ file name if a file of the suggested name already exists was incorrect. It was appending
+ the template used by mkstemps to the directory name component of the path rather than
+ using it as a prefix on the filename portion of the path. This resulted in a template path
+ like WebKitPDFs-ABCDEFXXXXXX-/foo.pdf where WebKitPDFs-ABCDEF/XXXXXX-foo.pdf was expected.
+
+ Reviewed by Jon Honeycutt.
+
+ * UIProcess/API/mac/PDFViewController.mm:
+ (WebKit::PDFViewController::pathToPDFOnDisk): Append the template as a new path component,
+ then append the suggested file name to that component.
+
2011-09-21 Andras Becsi <andras.be...@nokia.com>
[Qt] Remove Qt specific code from css/SelectorChecker.cpp
Modified: trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm (95606 => 95607)
--- trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm 2011-09-21 09:49:41 UTC (rev 95606)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm 2011-09-21 10:16:53 UTC (rev 95607)
@@ -567,8 +567,8 @@
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:path]) {
- NSString *pathTemplatePrefix = [pdfDirectoryPath stringByAppendingString:@"XXXXXX-"];
- NSString *pathTemplate = [pathTemplatePrefix stringByAppendingPathComponent:m_suggestedFilename.get()];
+ NSString *pathTemplatePrefix = [pdfDirectoryPath stringByAppendingPathComponent:@"XXXXXX-"];
+ NSString *pathTemplate = [pathTemplatePrefix stringByAppendingString:m_suggestedFilename.get()];
CString pathTemplateRepresentation = [pathTemplate fileSystemRepresentation];
int fd = mkstemps(pathTemplateRepresentation.mutableData(), pathTemplateRepresentation.length() - strlen([pathTemplatePrefix fileSystemRepresentation]) + 1);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes