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

Fix(tenant): Add tenant name in path for upload file #1712

Merged
merged 1 commit into from
Sep 26, 2023
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
2 changes: 1 addition & 1 deletion globalConfig.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"mongoUri":"mongodb://127.0.0.1:36595/jest?","mongoDBName":"jest"}
{"mongoUri":"mongodb://127.0.0.1:43217/jest?","mongoDBName":"jest"}
8 changes: 4 additions & 4 deletions src/api/controller/api/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export const parseRequest = async (ctx, loaderName, next) => {
totalChunks: parseInt(resumableTotalChunks, 10),
totalSize: parseInt(resumableTotalSize, 10),
currentChunkSize: parseInt(resumableCurrentChunkSize, 10),
filename: `${config.uploadDir}/${resumableIdentifier}`,
filename: `${config.uploadDir}/${ctx.tenant}_${resumableIdentifier}`,
extension,
chunkname: `${config.uploadDir}/${resumableIdentifier}.${chunkNumber}`,
chunkname: `${config.uploadDir}/${ctx.tenant}_${resumableIdentifier}.${chunkNumber}`,
stream,
customLoader: loaderName === 'custom-loader' ? customLoader : null,
};
Expand Down Expand Up @@ -168,8 +168,8 @@ export const checkChunkMiddleware = async (ctx, loaderName) => {
const chunkNumber = parseInt(resumableChunkNumber, 10);
const totalChunks = parseInt(resumableTotalChunks, 10);
const currentChunkSize = parseInt(resumableCurrentChunkSize, 10);
const filename = `${config.uploadDir}/${resumableIdentifier}`;
const chunkname = `${config.uploadDir}/${resumableIdentifier}.${resumableChunkNumber}`;
const filename = `${config.uploadDir}/${ctx.tenant}_${resumableIdentifier}`;
const chunkname = `${config.uploadDir}/${ctx.tenant}_${resumableIdentifier}.${resumableChunkNumber}`;
const [extension] = resumableFilename.match(/[^.]*$/);

const exists = await checkFileExists(chunkname, currentChunkSize);
Expand Down
4 changes: 2 additions & 2 deletions src/api/controller/api/upload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ describe('upload', () => {
expect(next).toHaveBeenCalled();
expect(ctx.resumable).toEqual({
stream: 'stream',
filename: `${config.uploadDir}/identifier`,
chunkname: `${config.uploadDir}/identifier.10`,
filename: `${config.uploadDir}/lodex_test_identifier`,
chunkname: `${config.uploadDir}/lodex_test_identifier.10`,
totalChunks: 100,
totalSize: 500,
currentChunkSize: 5,
Expand Down