mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-29 14:31:35 +08:00
extract pattern
This commit is contained in:
parent
1f5293ccc0
commit
f1468390dd
@ -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 =============
|
||||
|
||||
Loading…
Reference in New Issue
Block a user