mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-07-07 20:30:28 +03:00
Fix issue #810 - Wrong preview picture on share from another app
This commit is contained in:
parent
fdc2cb07c8
commit
78fccc9578
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue