mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-13 18:58:52 +01:00
Try to automatically determine an attachment name from a given URL similar to the name of an uploaded file
This commit is contained in:
@@ -141,6 +141,12 @@ class AttachmentFormType extends AbstractType
|
||||
}
|
||||
|
||||
if (!$file instanceof UploadedFile) {
|
||||
//When no file was uploaded, but a URL was entered, try to determine the attachment name from the URL
|
||||
if (empty($attachment->getName()) && !empty($attachment->getURL())) {
|
||||
$name = basename(parse_url($attachment->getURL(), PHP_URL_PATH));
|
||||
$attachment->setName($name);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user