maflcko / wiki-java-tools

Collection of tools for MediaWiki in Java
26 stars 21 forks source link

[Imker] Exception when creating files with forbidden characters in Windows #3

Closed maflcko closed 8 years ago

maflcko commented 9 years ago

E.g. downloading http://commons.wikimedia.org/wiki/File:Windows-forbidden-chars*%22%3F.png gives java.io.FileNotFoundException: C:\Users\marco\Downloads\temp\4\Windows-forbidden-chars*"?.png (The filename, directory name, or volume label syntax is incorrect)

maflcko commented 9 years ago

Thank you for letting me know this issue is relevant!

What would you expect the downloader to do for such files?

maflcko commented 9 years ago

It is now possible to replace such characters. Important to note that the issue is not fully solved, though.

ikarth commented 9 years ago

Would using URLEncoder be sufficient? http://stackoverflow.com/questions/1652483/convert-between-url-and-windows-filename-java

maflcko commented 9 years ago

URLEncoder does not encode * but it's a good start.

Also, if you want the encoding to be reversible and collision free, you'd have to encode all files downloaded.

maflcko commented 8 years ago

Recent version should ask you if you want to url encode file names. I don't think I can do any more than that.