Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

' in file name causes preview colorize.sh to fail #61

Open
GoogleCodeExporter opened this issue Apr 17, 2016 · 0 comments
Open

' in file name causes preview colorize.sh to fail #61

GoogleCodeExporter opened this issue Apr 17, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

*** NOTE: Do not report errors in syntax highlighting unless they are for
the following languages: C, Objective-C, or OCaml.  Report highlighting
bugs in other languages to http://www.andre-simon.de/mail.html ***

What steps will reproduce the problem?
1. Add ' to the name of a supported file
2. Attempt to preview.

What is the expected output? What do you see instead?
QLColorCode should produce a preview of the file instead a generic icon 
appears. 

What version of the product are you using? 2.0.1 On what operating system? 
10.6.3


Please provide any additional information below.
running qlmanage -p reveals an unmatch ' error in co

The following patch corrects this issue by escaping single quotes in file names.

diff --git a/Common.m b/Common.m
index 70e5d8e..f98b0e4 100644
--- a/Common.m
+++ b/Common.m
@@ -84,7 +84,7 @@ NSData *colorizeURL(CFBundleRef bundle, CFURLRef url, int 
*status, int thumbnail

     NSString *cmd = [NSString stringWithFormat:
                      @"'%@/colorize.sh' '%@' '%@' %s", 
-                     rsrcEsc, rsrcEsc, targetEsc, thumbnail ? "1" : "0"];
+                     rsrcEsc, rsrcEsc, [targetEsc 
stringByReplacingOccurrencesOfString:@"'" withString:@"'\\''"], thumbnail ? "1"
     n8log(@"cmd = %@", cmd);

     output = runTask(cmd, env, status);


Original issue reported on code.google.com by reeves.87 on 19 Jun 2010 at 4:57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant