Fixed backup urls for download

This commit is contained in:
snipe 2020-08-28 18:22:37 -07:00
parent 5aaa2430b4
commit e1cc003cec
No known key found for this signature in database
GPG key ID: 10BFFDA3ED34B5AC
2 changed files with 10 additions and 7 deletions

View file

@ -1018,8 +1018,6 @@ class SettingsController extends Controller
// Skip dotfiles like .gitignore and .DS_STORE
if ((substr(basename($backup_files[$f]), 0, 1) != '.')) {
\Log::debug(basename($backup_files[$f]));
\Log::debug($backup_files[$f]. ' is dotfileish?');
$files[] = [
'filename' => basename($backup_files[$f]),
@ -1081,9 +1079,11 @@ class SettingsController extends Controller
*/
public function downloadFile($filename = null)
{
$path = 'app/backups';
if (! config('app.lock_passwords')) {
if (Storage::exists($filename)) {
return Response::download(Storage::url('') . e($filename));
if (Storage::exists($path . '/' . $filename)) {
return Storage::download($path . '/' . $filename);
} else {
// Redirect to the backup page
return redirect()->route('settings.backups.index')->with('error', trans('admin/settings/message.backup.file_not_found'));
@ -1106,12 +1106,11 @@ class SettingsController extends Controller
public function deleteFile($filename = null)
{
if (! config('app.lock_passwords')) {
$path = 'backups';
$path = 'app/backups';
if (Storage::exists($path . '/' . $filename)) {
try {
Storage::delete($path . '/' . $filename);
return redirect()->route('settings.backups.index')->with('success', trans('admin/settings/message.backup.file_deleted'));
} catch (\Exception $e) {
\Log::debug($e);

View file

@ -29,7 +29,11 @@
<tbody>
@foreach ($files as $file)
<tr>
<td><a href="{{ Storage::url('backups/'.e($file['filename'])) }}">{{ $file['filename'] }}</a></td>
<td>
<a href="{{ route('settings.backups.download', [$file['filename']]) }}">
{{ $file['filename'] }}
</a>
</td>
<td>{{ date("M d, Y g:i A", $file['modified']) }} </td>
<td>{{ $file['filesize'] }}</td>
<td>