You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/Console/Commands/RestoreFromBackup.php
+99-52Lines changed: 99 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
useIlluminate\Console\Command;
6
6
useZipArchive;
7
7
useIlluminate\Support\Facades\Log;
8
+
useenshrined\svgSanitize\Sanitizer;
8
9
9
10
class SQLStreamer {
10
11
private$input;
@@ -242,9 +243,10 @@ public function handle()
242
243
243
244
$private_dirs = [
244
245
'storage/private_uploads/accessories',
245
-
'storage/private_uploads/assetmodels',
246
-
'storage/private_uploads/maintenances',
247
-
'storage/private_uploads/models',
246
+
'storage/private_uploads/assetmodels' => 'storage/private_uploads/models', //this was changed from assetmodels => models Aug 10 2025
247
+
'storage/private_uploads/asset_maintenances' => 'storage/private_uploads/maintenances', //this was changed from asset_maintenances => maintenances Aug 10 2025
248
+
'storage/private_uploads/maintenances', //but let 'maintenances' take precedence
249
+
'storage/private_uploads/models', //and let 'models' take precedence
248
250
'storage/private_uploads/assets', // these are asset _files_, not the pictures.
249
251
'storage/private_uploads/audits',
250
252
'storage/private_uploads/components',
@@ -262,7 +264,7 @@ public function handle()
262
264
];
263
265
$public_dirs = [
264
266
'public/uploads/accessories',
265
-
'public/uploads/assetmodels',
267
+
// 'public/uploads/assetmodels' => 'public/uploads/models', //according to git, this was _never_ a thing... (see below)
266
268
'public/uploads/maintenances',
267
269
'public/uploads/assets', // these are asset _pictures_, not asset files
268
270
'public/uploads/avatars',
@@ -273,7 +275,7 @@ public function handle()
273
275
'public/uploads/departments',
274
276
'public/uploads/locations',
275
277
'public/uploads/manufacturers',
276
-
'public/uploads/models',
278
+
'public/uploads/models',// ...it's been this way for 9 years (as of late 2025)
//print("INTERESTING - last_pos is $last_pos when searching $raw_path for $dir - last_pos+strlen(\$dir) is: ".($last_pos+strlen($dir))." and strlen(\$rawpath) is: ".strlen($raw_path)."\n");
326
-
//print("We would copy $raw_path to $dir.\n"); //FIXME append to a path?
//print("INTERESTING - last_pos is $last_pos when searching $raw_path for $dir - last_pos+strlen(\$dir) is: ".($last_pos+strlen($dir))." and strlen(\$rawpath) is: ".strlen($raw_path)."\n");
357
+
//print("We would copy $raw_path to $dir.\n"); //FIXME append to a path?
358
+
//the CSV bit, below, is because we store CSV files as "blahcsv" - without an extension
$file = substr($file, 0, -1); //trim last character (which should be the wildcard)
352
382
}
353
-
//print("INTERESTING - last_pos is $last_pos when searching $raw_path for $file - last_pos+strlen(\$file) is: ".($last_pos+strlen($file))." and strlen(\$rawpath) is: ".strlen($raw_path)."\n");
354
-
//no wildcards found in $file, process 'normally'
355
-
if ($last_pos + strlen($file) == strlen($raw_path) || $has_wildcard) { //again, no trailing slash. or this is a wildcard and we just take it.
356
-
// print("FOUND THE EXACT FILE: $file AT: $raw_path!!!\n"); //we *do* care about this, though.
$last_pos = strrpos($raw_path, $file); // no trailing slash!
384
+
if ($last_pos !== false) {
385
+
if (!in_array($extension, $allowed_extensions)) {
386
+
// gathering potentially unsafe files here to return at exit
387
+
$unsafe_files[] = $raw_path;
388
+
Log::debug('Potentially unsafe file ' . $raw_path . ' is being skipped');
389
+
$boring_files[] = $raw_path;
390
+
continue3;
391
+
}
392
+
//print("INTERESTING - last_pos is $last_pos when searching $raw_path for $file - last_pos+strlen(\$file) is: ".($last_pos+strlen($file))." and strlen(\$rawpath) is: ".strlen($raw_path)."\n");
393
+
//no wildcards found in $file, process 'normally'
394
+
if ($last_pos + strlen($file) == strlen($raw_path) || $has_wildcard) { //again, no trailing slash. or this is a wildcard and we just take it.
395
+
// print("FOUND THE EXACT FILE: $file AT: $raw_path!!!\n"); //we *do* care about this, though.
0 commit comments