RaptDept / chm2pdf

Automatically exported from code.google.com/p/chm2pdf
GNU General Public License v2.0
0 stars 0 forks source link

Failed if the file name contain a single-quote \' #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. rename a legitimate chm file into abc\'xyz 
2. chm2pdf --book abc\'xyz
3.

What is the expected output? What do you see instead?

Got an error saying a tmp folder doesn't exit.

sh: Syntax error: Unterminated quoted string
Traceback (most recent call last):
  File "/usr/bin/chm2pdf", line 1108, in <module>
    main(sys.argv)
  File "/usr/bin/chm2pdf", line 1102, in main
    convert_to_pdf(cfile, filename, outputfilename, options)
  File "/usr/bin/chm2pdf", line 318, in convert_to_pdf
    objective_urls=get_objective_urls_list(filename)
  File "/usr/bin/chm2pdf", line 116, in get_objective_urls_list
    flist=open(CHM2PDF_WORK_DIR+'/urlslist.txt','rU')
IOError: [Errno 2] No such file or directory: 
"/tmp/tmp9iuwl8/abc'xyz/urlslist.txt"

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

Version 0.9.1
Ubuntu 10.04

Please provide any additional information below.

The problem can be fixed by adding the following lines.

1069d1068
<     basename = '_' + re.sub(r'[^\w]', '', basename)
1091d1089
<     filename = filename.replace("\'", "\\\'") 
1093d1090
<     outputfilename = outputfilename.replace("\'", "\\\'") 

Original issue reported on code.google.com by peter.k....@gmail.com on 21 Sep 2012 at 5:36