Fix issue #810 - Wrong preview picture on share from another app

This commit is contained in:
Thomas 2025-04-09 12:28:30 +02:00
parent fdc2cb07c8
commit 78fccc9578

View file

@ -1848,7 +1848,6 @@ public class Helper {
if (responseCode == HttpURLConnection.HTTP_OK) { if (responseCode == HttpURLConnection.HTTP_OK) {
String fileName = ""; String fileName = "";
String disposition = httpURLConnection.getHeaderField("Content-Disposition"); String disposition = httpURLConnection.getHeaderField("Content-Disposition");
if (disposition != null) { if (disposition != null) {
// extracts file name from header field // extracts file name from header field
int index = disposition.indexOf("filename="); int index = disposition.indexOf("filename=");
@ -1858,7 +1857,12 @@ public class Helper {
} }
} else { } else {
// extracts file name from URL // extracts file name from URL
fileName = downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1); try {
URL downLoadUrlTmp = new URL(downloadUrl);
fileName = downLoadUrlTmp.getPath().replace("/","_");
}catch (Exception exception) {
fileName = downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1);
}
} }
fileName = FileNameCleaner.cleanFileName(fileName); fileName = FileNameCleaner.cleanFileName(fileName);
// opens input stream from the HTTP connection // opens input stream from the HTTP connection