Page MenuHomePhabricator

D8989.diff
No OneTemporary

D8989.diff

diff --git a/lib/utils/blob-service.js b/lib/utils/blob-service.js
--- a/lib/utils/blob-service.js
+++ b/lib/utils/blob-service.js
@@ -2,6 +2,7 @@
import invariant from 'invariant';
+import { replacePathParams, type URLPathParams } from './url-utils.js';
import type { BlobServiceHTTPEndpoint } from '../facts/blob-service.js';
import blobServiceConfig from '../facts/blob-service.js';
@@ -37,12 +38,9 @@
function makeBlobServiceEndpointURL(
endpoint: BlobServiceHTTPEndpoint,
- params: { +[name: string]: string } = {},
+ params: URLPathParams = {},
): string {
- let path = endpoint.path;
- for (const name in params) {
- path = path.replace(`:${name}`, params[name]);
- }
+ const path = replacePathParams(endpoint.path, params);
return `${blobServiceConfig.url}${path}`;
}
diff --git a/lib/utils/url-utils.js b/lib/utils/url-utils.js
--- a/lib/utils/url-utils.js
+++ b/lib/utils/url-utils.js
@@ -115,4 +115,13 @@
const setURLPrefix = 'SET_URL_PREFIX';
-export { infoFromURL, setURLPrefix };
+export type URLPathParams = { +[name: string]: string };
+
+function replacePathParams(path: string, params: URLPathParams = {}): string {
+ for (const name in params) {
+ path = path.replace(`:${name}`, params[name]);
+ }
+ return path;
+}
+
+export { infoFromURL, setURLPrefix, replacePathParams };

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 3:56 AM (19 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2698226
Default Alt Text
D8989.diff (1 KB)

Event Timeline