Skip to content

Commit 96370e1

Browse files
ujvzoleebhstahl
authored andcommitted
Fixed url generation
1 parent 7b7ac6c commit 96370e1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/handlers/BaseHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class BaseHandler extends EventEmitter {
4141
* @return {bool|string}
4242
*/
4343
getFileIdFromRequest(req) {
44-
const re = new RegExp(`${req.baseUrl || this.store.path}\\/(\\S+)\\/?`); // eslint-disable-line prefer-template
44+
const re = new RegExp(`${req.baseUrl || ''}${this.store.path}\\/(\\S+)\\/?`); // eslint-disable-line prefer-template
4545
const match = (req.originalUrl || req.url).match(re);
4646
if (!match) {
4747
return false;

lib/handlers/PostHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PostHandler extends BaseHandler {
1515
send(req, res) {
1616
return this.store.create(req)
1717
.then((File) => {
18-
const url = `//${req.headers.host}${req.baseUrl || this.store.path}/${File.id}`;
18+
const url = `//${req.headers.host}${req.baseUrl || ''}${this.store.path}/${File.id}`;
1919
this.emit(EVENT_ENDPOINT_CREATED, { url });
2020
return super.send(res, 201, { Location: url });
2121
})

0 commit comments

Comments
 (0)