strongloop / loopback-component-storage

Storage component for LoopBack.
Other
130 stars 155 forks source link

filesystem provider: Server crash on invalid container name #272

Closed jigarzon closed 5 years ago

jigarzon commented 5 years ago

Description/Steps to reproduce

POST /containers/%2E%2E/upload

Note: %2E%2E is equivalent of two dots: ..

Expected result

Forbidden error thrown or similar

Additional information

Error [ERR_METHOD_NOT_IMPLEMENTED]: The _write() method is not implemented
    at Writable._write (_stream_writable.js:566:6)
    at doWrite (_stream_writable.js:415:12)
    at writeOrBuffer (_stream_writable.js:399:5)
    at Writable.write (_stream_writable.js:299:11)
    at Stream.ondata (internal/streams/legacy.js:15:31)
    at Stream.emit (events.js:198:15)
    at MultipartParser.parser.onPartData (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:387:14)
    at callback (/home/user/my-project/node_modules/formidable/lib/multipart_parser.js:102:31)
    at dataCallback (/home/user/my-project/node_modules/formidable/lib/multipart_parser.js:115:11)
    at MultipartParser.write (/home/user/my-project/node_modules/formidable/lib/multipart_parser.js:237:15)
    at IncomingForm.write (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:159:34)
    at IncomingMessage.<anonymous> (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:125:12)
    at IncomingMessage.emit (events.js:193:13)
    at IncomingMessage.Readable.read (_stream_readable.js:496:10)
    at flow (_stream_readable.js:969:34)
    at resume_ (_stream_readable.js:950:3)
Error: FileSystemProvider: Nombre no válido: ..
    at FileSystemProvider.upload (/home/user/my-project/node_modules/loopback-component-storage/lib/providers/filesystem/index.js:205:7)
    at IncomingForm.form.handlePart (/home/user/my-project/node_modules/loopback-component-storage/lib/storage-handler.js:168:27)
    at IncomingForm.onPart (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:179:8)
    at MultipartParser.parser.onHeadersEnd (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:420:10)
    at callback (/home/user/my-project/node_modules/formidable/lib/multipart_parser.js:102:31)
    at MultipartParser.write (/home/user/my-project/node_modules/formidable/lib/multipart_parser.js:215:9)
    at IncomingForm.write (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:159:34)
    at IncomingMessage.<anonymous> (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:125:12)
    at IncomingMessage.emit (events.js:193:13)
    at IncomingMessage.Readable.read (_stream_readable.js:496:10)
    at flow (_stream_readable.js:969:34)
    at resume_ (_stream_readable.js:950:3)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
/home/user/my-project/node_modules/loopback-phase/node_modules/async/dist/async.js:966
        if (fn === null) throw new Error("Callback was already called.");
                         ^

Error: Callback was already called.
    at /home/user/my-project/node_modules/loopback-phase/node_modules/async/dist/async.js:966:32
    at /home/user/my-project/node_modules/strong-remoting/lib/remote-objects.js:697:7
    at /home/user/my-project/node_modules/strong-remoting/lib/http-context.js:303:16
    at callback (/home/user/my-project/node_modules/strong-remoting/lib/shared-method.js:252:14)
    at /home/user/my-project/node_modules/loopback-component-storage/lib/storage-handler.js:226:14
    at IncomingForm.<anonymous> (/home/user/my-project/node_modules/formidable/lib/incoming_form.js:104:9)
    at IncomingForm.emit (events.js:193:13)
    at Writable.<anonymous> (/home/user/my-project/node_modules/loopback-component-storage/lib/storage-handler.js:171:12)
    at Writable.emit (events.js:193:13)
    at /home/user/my-project/node_modules/loopback-component-storage/lib/providers/filesystem/index.js:73:15
    at processTicksAndRejections (internal/process/task_queues.js:79:9)
dhmlau commented 5 years ago

@hacksparrow, could you please take a look? Thanks.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.