mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-25 19:52:48 +00:00
fix: use regexp to explictly identify custom schem apps (https://github.com/cloudreve/Cloudreve/issues/2343)
This commit is contained in:
parent
a06b59fa41
commit
7c91c699e4
|
|
@ -282,8 +282,8 @@ export function openCustomViewer(file: FileResponse, viewer: Viewer, preferredVe
|
|||
url = url.replace(`{$${key}}`, vars[key]);
|
||||
}
|
||||
|
||||
// if not start with http or https, it's a custom scheme
|
||||
if (!url.startsWith("http") && !url.startsWith("https")) {
|
||||
// if url matches custom scheme pattern like nplayer://xxx, use window.location.assign
|
||||
if (/^(?!https?:\/\/)[a-zA-Z0-9]+:\/\//.test(url)) {
|
||||
window.location.assign(url);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue