fix(launcher): bypass downloads for url files
This commit is contained in:
@@ -174,6 +174,16 @@ let shortened_filename = $derived(
|
||||
})
|
||||
);
|
||||
|
||||
let is_url_file = $derived.by(() => {
|
||||
const raw_filename = (hosted_file_obj?.filename ?? '').toLowerCase();
|
||||
const extension = (hosted_file_obj?.extension ?? '').toLowerCase();
|
||||
return (
|
||||
raw_filename.startsWith('http://') ||
|
||||
raw_filename.startsWith('https://') ||
|
||||
extension === 'url'
|
||||
);
|
||||
});
|
||||
|
||||
let direct_download_url = $derived.by(() => {
|
||||
if (!show_direct_download || !hosted_file_obj) return '';
|
||||
// IMPORTANT: For Direct Link Mode, we MUST use the V3 Action endpoint to support Random String IDs.
|
||||
@@ -190,6 +200,19 @@ let direct_download_url = $derived.by(() => {
|
||||
|
||||
async function handle_click() {
|
||||
const file_id = hosted_file_obj?.hosted_file_id ?? hosted_file_id;
|
||||
|
||||
// URL-backed records are intentionally not downloaded. Callers are expected
|
||||
// to provide a custom click handler that opens the URL directly.
|
||||
if (is_url_file) {
|
||||
if (click) {
|
||||
const result = click();
|
||||
if (track_click_promise && result instanceof Promise) {
|
||||
ae_promises[file_id] = result;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
download_complete = undefined;
|
||||
download_status_msg = 'Downloading...';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user