Skip to content

Commit

Permalink
fix(attachments): Uploading of attachments from public shares
Browse files Browse the repository at this point in the history
The session middleware expects the share token as param `token`.

Fixes: #6206

Signed-off-by: Jonas <jonas@freesources.org>

[skip ci]
  • Loading branch information
mejo- authored and backportbot[bot] committed Aug 15, 2024
1 parent 756bfc7 commit caa222f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Controller/AttachmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ public function uploadAttachment(?string $shareToken = null): DataResponse {
throw new Exception('Could not read file');
}
$newFileName = $file['name'];
if ($shareToken) {
$uploadResult = $this->attachmentService->uploadAttachmentPublic($documentId, $newFileName, $newFileResource, $shareToken);
if ($token) {
$uploadResult = $this->attachmentService->uploadAttachmentPublic($documentId, $newFileName, $newFileResource, $token);
} else {
$userId = $this->getSession()->getUserId();
$uploadResult = $this->attachmentService->uploadAttachment($documentId, $newFileName, $newFileResource, $userId);
Expand Down
2 changes: 1 addition & 1 deletion src/services/SessionApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class Connection {
+ '?documentId=' + encodeURIComponent(this.#document.id)
+ '&sessionId=' + encodeURIComponent(this.#session.id)
+ '&sessionToken=' + encodeURIComponent(this.#session.token)
+ '&shareToken=' + encodeURIComponent(this.#options.shareToken || '')
+ '&token=' + encodeURIComponent(this.#options.shareToken || '')
return this.#post(url, formData, {
headers: {
'Content-Type': 'multipart/form-data',
Expand Down

0 comments on commit caa222f

Please sign in to comment.