Skip to content

Commit

Permalink
Smaller changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lehecht committed May 21, 2024
1 parent 4225371 commit 3bcce9e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Http/Requests/StoreStorageRequestFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function withValidator($validator)
$shouldDeletePreviousChunks = false;

if ($file->getSize() > $user->storage_quota_remaining) {
$validator->errors()->add('storage_exceeded', 'The file size exceeds the available storage quota.');
$validator->errors()->add('file', 'The file size exceeds the available storage quota.');
$shouldDeletePreviousChunks = true;
}

Expand Down Expand Up @@ -170,6 +170,7 @@ public function withValidator($validator)
$existsInOtherRequest = StorageRequestFile::join('storage_requests', 'storage_requests.id', '=', 'storage_request_files.storage_request_id')
->where('storage_requests.id', '!=', $this->storageRequest->id)
->where('storage_requests.user_id', $this->storageRequest->user_id)
// Don't use $path here, because it contains directory name
->where('storage_request_files.path','LIKE', '%'.$filename.'%')
->exists();

Expand Down
4 changes: 2 additions & 2 deletions src/Jobs/DeleteStorageRequestFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function handle()
$file = StorageRequestFile::where('path','=',$this->path);

// Do not delete files when delete-request is outdated
if($file->exists() && $this->retryCount != $file->first()->retry_count){
if($file->exists() && $this->retryCount != $file->first()->retry_count) {
return;
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public function handle()
}
}

if($file->exists()){
if($file->exists()) {
$file->delete();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class="btn btn-success"
</div>
<div v-cloak v-if="finishIncomplete && !loading" class="panel panel-warning text-center">
<div class="panel-body text-warning">
<p><i class="fa fa-exclamation-triangle"> </i></p><p>Some file uploads failed.</p>
<p><i class="fa fa-exclamation-triangle"> </i></p><p>Some file uploads failed</p>
<p>
<button class="btn btn-default btn" title="Skip failed uploads" v-on:click="skipFailedFiles">
<i class="fa fa-arrow-left"></i> Skip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,15 @@ public function testStoreChunkChunkIndexExists()
])
->assertStatus(200);

// Duplicated chunks do not cause errors any more
$res2 = $this->postJson("/api/v1/storage-requests/{$id}/files", [
'file' => $file,
'chunk_index' => 0,
'chunk_total' => 2,
])
->assertStatus(200);

// Filemodel is just returned
// File model is just returned
$this->assertEquals($res1->getContent(), $res2->getContent());
}

Expand Down

0 comments on commit 3bcce9e

Please sign in to comment.