Skip to content

Commit

Permalink
Merge e151d4e into b5ca5c2
Browse files Browse the repository at this point in the history
  • Loading branch information
gormed committed Aug 16, 2018
2 parents b5ca5c2 + e151d4e commit 98cd4c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/handlers/PostHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class PostHandler extends BaseHandler {
send(req, res) {
return this.store.create(req)
.then((File) => {
const url = `//${req.headers.host}${req.baseUrl || ''}${this.store.path}/${File.id}`;
const url = this.store.relativeLocation ? `${File.id}` : `//${req.headers.host}${req.baseUrl || ''}${this.store.path}/${File.id}`;

this.emit(EVENT_ENDPOINT_CREATED, { url });
return super.send(res, 201, { Location: url });
})
Expand Down
1 change: 1 addition & 0 deletions lib/stores/FileStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class FileStore extends DataStore {
super(options);

this.directory = options.directory || options.path.replace(/^\//, '');
this.relativeLocation = options.relativeLocation || false;

this.extensions = ['creation', 'creation-defer-length'];
this.configstore = new Configstore(`${pkg.name}-${pkg.version}`);
Expand Down

0 comments on commit 98cd4c8

Please sign in to comment.