bug fixes

This commit is contained in:
carodej
2020-08-05 16:51:44 +02:00
parent fc2c4de50f
commit fb790200d4
7 changed files with 21 additions and 14 deletions

View File

@@ -101,7 +101,7 @@ class FileAccessController extends Controller
$shared = get_shared($token);
// Abort if shared is protected
if ($shared->protected) {
if ((int) $shared->protected) {
abort(403, "Sorry, you don't have permission");
}
@@ -154,7 +154,7 @@ class FileAccessController extends Controller
$shared = get_shared($token);
// Abort if thumbnail is protected
if ($shared->protected) {
if ((int) $shared->protected) {
abort(403, "Sorry, you don't have permission");
}

View File

@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\Share\AuthenticateShareRequest;
use App\Http\Resources\ShareResource;
use App\Http\Tools\Guardian;
use App\Setting;
use http\Env\Response;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\Cookie;
@@ -42,14 +43,14 @@ class FileSharingController extends Controller
Cookie::queue('shared_access_token', '', -1);
// Set cookies
if ($shared->protected) {
if ((int) $shared->protected) {
// Set shared token
Cookie::queue('shared_token', $token, 43200);
}
// Check if shared is image file and then show it
if ($shared->type === 'file' && ! $shared->protected) {
if ($shared->type === 'file' && ! (int) $shared->protected) {
$image = FileManagerFile::where('user_id', $shared->user_id)
->where('type', 'image')
@@ -61,8 +62,12 @@ class FileSharingController extends Controller
}
}
// Get all settings
$settings = Setting::all();
// Return page index
return view("index");
return view("index")
->with('settings', $settings ? json_decode($settings->pluck('value', 'name')->toJson()) : null);
}
/**
@@ -160,7 +165,7 @@ class FileSharingController extends Controller
$shared = Share::where(DB::raw('BINARY `token`'), $token)->firstOrFail();
// Abort if folder is protected
if ($shared->protected) {
if ((int) $shared->protected) {
abort(403, "Sorry, you don't have permission");
}
@@ -191,7 +196,7 @@ class FileSharingController extends Controller
$shared = Share::where(DB::raw('BINARY `token`'), $token)->firstOrFail();
// Abort if file is protected
if ($shared->protected) {
if ((int) $shared->protected) {
abort(403, "Sorry, you don't have permission");
}
@@ -341,7 +346,7 @@ class FileSharingController extends Controller
$shared = get_shared($token);
// Abort if folder is protected
if ($shared->protected) {
if ((int) $shared->protected) {
abort(403, "Sorry, you don't have permission");
}

View File

@@ -248,8 +248,8 @@ function get_unique_id(): int
$files = FileManagerFile::withTrashed()->get();
// Get last ids
$folders_unique = $folders->isEmpty() ? 0 : $folders->last()->unique_id;
$files_unique = $files->isEmpty() ? 0 : $files->last()->unique_id;
$folders_unique = $folders->isEmpty() ? 0 : (int) $folders->last()->unique_id;
$files_unique = $files->isEmpty() ? 0 : (int) $files->last()->unique_id;
// Count new unique id
$unique_id = $folders_unique > $files_unique ? $folders_unique + 1 : $files_unique + 1;

View File

@@ -20,8 +20,8 @@ class ShareResource extends JsonResource
'type' => 'shares',
'attributes' => [
'permission' => $this->permission,
'protected' => $this->protected,
'item_id' => $this->item_id,
'protected' => (int) $this->protected,
'item_id' => (int) $this->item_id,
'token' => $this->token,
'link' => $this->link,
'type' => $this->type,

View File

@@ -270,7 +270,7 @@ class Editor
self::check_user_storage_capacity($user_id, $file_size, $temp_filename);
// Create thumbnail
$thumbnail = self::get_image_thumbnail('chunks/' . $temp_filename, $user_file_name);
$thumbnail = self::get_image_thumbnail('chunks/' . $temp_filename, $disk_file_name);
// Move finished file from chunk to file-manager directory
$disk_local->move('chunks/' . $temp_filename, 'file-manager/' . $disk_file_name);

2
public/js/main.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -167,6 +167,8 @@ const Helpers = {
Vue.prototype.$uploadFiles = async function (files) {
if (files.length == 0) return
this.$handleUploading(files, undefined)
}