Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable31] fix: prevent success when signature file dont exists #4642

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/Service/FolderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,22 @@ public function getFileById(?int $nodeId = null): File {
foreach ($mountsContainingFile as $fileInfo) {
$this->root->getByIdInPath($nodeId, $fileInfo->getMountPoint());
}
/** @var File[] */
$file = $this->root->getById($nodeId);
if ($file) {
/** @var File */
if (!$file[0]->fopen('r')) {
throw new NotFoundException('Invalid node');
}
return $file[0];
}

$folder = $this->root->getUserFolder($this->getUserId());
/** @var File[] */
$file = $folder->getById($nodeId);
if ($file) {
/** @var File */
if (!$file[0]->fopen('r')) {
throw new NotFoundException('Invalid node');
}
return current($file);
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/Components/PreviewSignature/PreviewSignature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ export default {
.then(response => {
const buffer = Buffer.from(response.data, 'binary').toString('base64')
this.imageData = 'data:application/pdf;base64,' + buffer
this.onImageLoad()
this.onImageLoad(true)
})
.catch(() => this.onImageLoad(false))
},
onImageLoad() {
onImageLoad(status) {
this.loading = false
this.isLoaded = true
this.$emit('loaded')
this.$emit('loaded', status)
},
},
}
Expand Down
8 changes: 5 additions & 3 deletions src/views/Account/partials/Signature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ export default {
data: () => ({
isEditing: false,
isSignatureLoaded: false,
signatureExists: true,
}),
computed: {
hasSignature() {
return this.signatureElementsStore.hasSignatureOfType(this.type)
return this.signatureElementsStore.hasSignatureOfType(this.type) && this.signatureExists
},
imgSrc() {
if (this.signatureElementsStore.signs[this.type]?.value?.startsWith('data:')) {
Expand All @@ -91,8 +92,9 @@ export default {
},
},
methods: {
signatureLoaded() {
this.isSignatureLoaded = true
signatureLoaded(success) {
this.isSignatureLoaded = success
this.signatureExists = success
},
edit() {
this.isEditing = true
Expand Down
Loading