Skip to content

Commit

Permalink
Fix download to authorize absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlpp committed Oct 28, 2015
1 parent 627a888 commit d3b42cc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Dvlpp/Sharp/Http/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ public function download($fileShortPath)
$path = $fileShortPath;
}

$fullpath = config("sharp.upload_storage_base_path") . "/" . $path;
if(!starts_with($path, "/")) {
$path = config("sharp.upload_storage_base_path") . "/" . $path;
}

return (new Response(
Storage::disk($disk)->get($fullpath), 200
))->header('Content-Type', Storage::disk($disk)->mimeType($fullpath))
Storage::disk($disk)->get($path), 200
))->header('Content-Type', Storage::disk($disk)->mimeType($path))
->header("Content-Disposition", "attachment");
}

Expand Down

0 comments on commit d3b42cc

Please sign in to comment.