mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-29 16:50:10 +02:00
DownloadFileThread now removes all illegal chars from filenames before trying to write the file to disk
This commit is contained in:
@@ -62,12 +62,19 @@ class DownloadFileThread extends Thread {
|
|||||||
this.cookies = cookies;
|
this.cookies = cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File sanitizeSaveAs(File fileToSan) {
|
||||||
|
String fileName = fileToSan.getName().replaceAll("[\\\\/:*?\"<>|]", "_");
|
||||||
|
return new File(saveAs.getParentFile().getAbsolutePath() + File.separator + fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to download the file. Retries as needed.
|
* Attempts to download the file. Retries as needed.
|
||||||
* Notifies observers upon completion/error/warn.
|
* Notifies observers upon completion/error/warn.
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
|
// First thing we make sure the file name doesn't have any illegal chars in it
|
||||||
|
saveAs = sanitizeSaveAs(saveAs);
|
||||||
long fileSize = 0;
|
long fileSize = 0;
|
||||||
int bytesTotal = 0;
|
int bytesTotal = 0;
|
||||||
int bytesDownloaded = 0;
|
int bytesDownloaded = 0;
|
||||||
|
Reference in New Issue
Block a user