Skip to content

Commit 15ee3e0

Browse files
committed
chore: update file tags handling to make tests pass
1 parent ab306f4 commit 15ee3e0

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/Routers/FilesRouter.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,14 @@ export class FilesRouter {
167167
const bufferData = Buffer.from(fileObject.file._data, 'base64');
168168
fileObject.fileSize = Buffer.byteLength(bufferData);
169169
// prepare file options
170-
const fileTags = fileObject.file._tags;
171-
let fileOptions = {
170+
const fileOptions = {
172171
metadata: fileObject.file._metadata,
173172
};
174-
if (Object.keys(fileTags).length > 0) {
175-
// some s3-compatible providers (DigitalOcean, Linode) do not accept tags
176-
// so we do not include the tags option if it is empty.
177-
fileOptions = {
178-
...fileOptions,
179-
tags: fileTags,
180-
};
181-
}
173+
// some s3-compatible providers (DigitalOcean, Linode) do not accept tags
174+
// so we do not include the tags option if it is empty.
175+
const fileTags =
176+
Object.keys(fileObject.file._tags).length > 0 ? { tags: fileObject.file._tags } : {};
177+
Object.assign(fileOptions, fileTags);
182178
// save file
183179
const createFileResult = await filesController.createFile(
184180
config,

0 commit comments

Comments
 (0)