TASK22269: normalize document hash-suffix route composition
This commit is contained in:
@@ -70,7 +70,7 @@ const loadFileRouteBuilderModule = (injected = {}) => {
|
||||
source = source.replace(/import[\s\S]*?from\s+"[^"]+";\n?/g, "");
|
||||
source = source.replace(/export const\s+/g, "const ");
|
||||
source +=
|
||||
"\nmodule.exports = { buildFileQuery, withBaseUrl, appendQuerySuffix };\n";
|
||||
"\nmodule.exports = { buildFileQuery, withBaseUrl, appendQuerySuffix, appendHashSuffix };\n";
|
||||
|
||||
const context = {
|
||||
module: { exports: {} },
|
||||
@@ -211,6 +211,12 @@ test("clients/fileRouteBuilder builds query with optional encoding and suffix he
|
||||
mod.appendQuerySuffix(unencoded, "&hash=123"),
|
||||
"/api/file/getbloblist?container=abc&casefolderID=x/y&hash=123"
|
||||
);
|
||||
assert.strictEqual(
|
||||
mod.appendHashSuffix(unencoded, (route) =>
|
||||
route.includes("getbloblist") ? "&hash=abc" : ""
|
||||
),
|
||||
"/api/file/getbloblist?container=abc&casefolderID=x/y&hash=abc"
|
||||
);
|
||||
});
|
||||
|
||||
const run = async () => {
|
||||
|
||||
Reference in New Issue
Block a user