Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3521562
D8989.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8989.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D8989: [client-backup] extract shared code for creating service endpoint path
Attached
Detach File
Event Timeline
Log In to Comment