mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Updated image drop handling to respect original file name
Now uses the previously timestamp gen name as a backup to the original name. Aligns with the image manager upload which uses the original name where given. Closes #3470
This commit is contained in:
parent
3f271ebecb
commit
3fe666f36a
@ -60,13 +60,7 @@ async function uploadImageFile(file, pageId) {
|
||||
throw new Error(`Not an image file`);
|
||||
}
|
||||
|
||||
let ext = 'png';
|
||||
if (file.name) {
|
||||
let fileNameMatches = file.name.match(/\.(.+)$/);
|
||||
if (fileNameMatches.length > 1) ext = fileNameMatches[1];
|
||||
}
|
||||
|
||||
const remoteFilename = "image-" + Date.now() + "." + ext;
|
||||
const remoteFilename = file.name || `image-${Date.now()}.png`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file, remoteFilename);
|
||||
formData.append('uploaded_to', pageId);
|
||||
|
Loading…
Reference in New Issue
Block a user