From d064f04af00c46ae366636ee88f20c0ccc55aa1d Mon Sep 17 00:00:00 2001 From: jeff-zucker Date: Thu, 5 Nov 2020 17:19:15 -0800 Subject: [PATCH] revert to sending pathname for location header --- src/rest.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rest.js b/src/rest.js index 401b92a..ff558df 100644 --- a/src/rest.js +++ b/src/rest.js @@ -195,7 +195,8 @@ async fetch(uri, options = {}) { slug = await _getAvailableUrl(pathname, slug, options) // jz add pathname = _mungePath(pathname, slug, options) const [status, , headers] = await self.storage(options).postContainer(pathname,options) - Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) + '/' }) +// Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) + '/' }) + Object.assign(resOptions.headers, { location: pathname + '/' }) Object.assign(resOptions.headers, headers) return _response(null, resOptions, status) } @@ -205,7 +206,8 @@ async fetch(uri, options = {}) { pathname = _mungePath(pathname, slug, options) if (isLink(pathname, options)) return _response(null, resOptions, 405) const [status, , headers] = await self.storage(options).putResource( pathname, options) - Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) }) +// Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) }) + Object.assign(resOptions.headers, { location: pathname }) Object.assign(resOptions.headers, headers) return _response(null, resOptions, status) } @@ -467,6 +469,8 @@ function _mungePath(pathname, slug, options) { return pathname; } +/* not needed? location returns pathname, not URL + function mapPathToUrl (pathname, options) { let prefix = options.rest_prefix; if (prefix === 'file') { @@ -475,6 +479,7 @@ function mapPathToUrl (pathname, options) { } return options.scheme + '//' + prefix + pathname } +*/ } // end of fetch() } // end of SolidRest()