Trim filename if it is too long
Caused download failures on filesystems with filename limitations fixes #579
This commit is contained in:
parent
d697fab7eb
commit
e127fa79c7
@ -378,10 +378,13 @@ public class DownloadRequester {
|
|||||||
|
|
||||||
String URLBaseFilename = URLUtil.guessFileName(media.getDownload_url(),
|
String URLBaseFilename = URLUtil.guessFileName(media.getDownload_url(),
|
||||||
null, media.getMime_type());
|
null, media.getMime_type());
|
||||||
;
|
|
||||||
|
|
||||||
if (titleBaseFilename != "") {
|
if (!titleBaseFilename.equals("")) {
|
||||||
// Append extension
|
// Append extension
|
||||||
|
final int FILENAME_MAX_LENGTH = 220;
|
||||||
|
if (titleBaseFilename.length() > FILENAME_MAX_LENGTH) {
|
||||||
|
titleBaseFilename = titleBaseFilename.substring(0, FILENAME_MAX_LENGTH);
|
||||||
|
}
|
||||||
filename = titleBaseFilename + FilenameUtils.EXTENSION_SEPARATOR +
|
filename = titleBaseFilename + FilenameUtils.EXTENSION_SEPARATOR +
|
||||||
FilenameUtils.getExtension(URLBaseFilename);
|
FilenameUtils.getExtension(URLBaseFilename);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user