mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 08:05:33 +02:00
Only avoid overwriting files (introduced in b159581156) if avoid_overwriting is set on the field
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* Fixed issue in `selfupgrade` where the package would get downloaded in the wrong destination
|
||||
* Hide tab when user is not authorized to access it [#712](https://github.com/getgrav/grav-plugin-admin/issues/712)
|
||||
* Fixed Lists issue when reindexing, causing Radio fields to potentially lose their `checked` status
|
||||
* Avoid overwriting a file when uploaded with the same filename through the Admin blueprint `file` type
|
||||
* Avoid overwriting a file when uploaded with the same filename through the Admin blueprint `file` field type if `avoid_overwriting` is enabled on the field
|
||||
|
||||
# v1.1.2
|
||||
## 07/16/2016
|
||||
|
||||
@@ -1351,8 +1351,10 @@ class AdminController
|
||||
Folder::mkdir($resolved_destination);
|
||||
}
|
||||
|
||||
if (file_exists("$resolved_destination/$name")) {
|
||||
$name = date('YmdHis') . '-' . $name;
|
||||
if (isset($field['avoid_overwriting']) && $field['avoid_overwriting'] === true) {
|
||||
if (file_exists("$resolved_destination/$name")) {
|
||||
$name = date('YmdHis') . '-' . $name;
|
||||
}
|
||||
}
|
||||
|
||||
if (move_uploaded_file($tmp_name, "$resolved_destination/$name")) {
|
||||
|
||||
Reference in New Issue
Block a user