extract pattern

This commit is contained in:
suyao 2025-12-11 12:11:30 +08:00
parent 1f5293ccc0
commit f1468390dd
No known key found for this signature in database

View File

@ -187,11 +187,8 @@ class VolcengineService {
// RFC3986 unreserved: A-Z a-z 0-9 - _ . ~
// If encodeSlash is false, / is also unencoded
const unreserved = encodeSlash ? /[A-Za-z0-9_\-\.~]/ : /[A-Za-z0-9_\-\.~\/]/;
return str.replace(
new RegExp(`[^${encodeSlash ? 'A-Za-z0-9_\\-\\.~' : 'A-Za-z0-9_\\-\\.~/'}]`, 'g'),
(char) => encodeURIComponent(char)
);
const pattern = encodeSlash ? /[^A-Za-z0-9_\-.~]/g : /[^A-Za-z0-9_\-.~/]/g
return str.replace(pattern, (char) => encodeURIComponent(char))
}
// ============= Signing Implementation =============