hmjz100/LinkSwift · warning · Error

提示:<br/>请勾选要保存到网盘的文件哦~

Error message

提示:<br/>请勾选要保存到网盘的文件哦~

What it means

Thrown in the 'save to netdisk' (enhanced save) flow: before simulating a click on the Netdisk save button, the script requires at least one selected item via temp.main.getSelectedList(). Empty selection aborts with this HTML-wrapped popup message, reminding users the workflow is: select files, save to own netdisk, then download.

Source

Thrown at (改)网盘直链下载助手.user.js:6343

					const dialog = await Swal.fire({
						...temp.swalDefault,
						title: "提示",
						html: `<div style="display:flex;align-items:center;justify-content:center;">请先切换到&nbsp;&nbsp;<svg class="icon" class="icon--D3kMk " viewBox="0 0 1024 1024" width="20" height="20" fill="currentColor"><use xlink:href="#PDSDrag"></use></svg>&nbsp;<b>列表视图</b>&nbsp;&nbsp;后再获取下载链接哦</div>`,
						icon: "info",
						showCloseButton: true,
						showDenyButton: true,
						confirmButtonText: `<svg class="pl-icon"><use xlink:href="#pl-icon-fa-check"/></svg> 切换`,
						denyButtonText: `<svg class="pl-icon"><use xlink:href="#pl-icon-fa-x-mark"/></svg> 不要`,
					});
					if (dialog.isConfirmed) {
						document.querySelector(config.$aliyun.mount.switch).click();
						return message.success("提示:<br/>切换为列表视图成功<br/>请再获取一次下载链接吧~");
					}
					return false;
				}
				const selections = temp.main.getSelectedList();
				if (selections.length === 0) {
					throw new Error("提示:<br/>请勾选要保存到网盘的文件哦~");
				}
				message.info("提示:<br/>因网盘限制,请保存到自己网盘后再去下载哦~");
				await base.sleep(500);
				document.querySelector(`[class*="btn-save--"]`).click();
			});
			$doc.on("click", ".listener-api-download.enhance", async function (e) {
				e.preventDefault();
				const status = base._EventFactory(e);
				const file = {
					index: status.item.data("index"),
					link: status.item.data("link"),
					name: status.item.data("name"),
					size: status.item.data("size") || 0,
				}
				base._resetData(file.index);

				// UI 初始化
				status.down_normal.hide();

View on GitHub (pinned to 417ea5e28a)

Solutions

  1. Check at least one file checkbox before clicking save-to-netdisk.
  2. If selection looks present, switch to list view (the script prompts this) and re-select, then retry.
  3. Refresh the page to rebuild script state if selection events stopped registering.
Defensive patterns

Strategy: validation

Validate before calling

const selections = temp.main.getSelectedList();
if (!selections || selections.length === 0) { alert('请先勾选要保存的文件'); return; }

Type guard

function hasSelection(items) { return Array.isArray(items) && items.length > 0; }

Try / catch

try { await saveToNetdisk(); } catch (e) { if (String(e.message).includes('请勾选')) { alert('请先勾选文件'); return; } throw e; }

Prevention

When it happens

Trigger: User clicks the save-to-netdisk button while `temp.main.getSelectedList()` returns []; `selections.length === 0` triggers the throw before the script clicks `[class*="btn-save--"]`.

Common situations: User clicks save without ticking any rows; the Netdisk share page uses a view mode whose selection DOM the script can't read (hence the list-view toggle hint right above); stale script after SPA navigation lost selection state.

Related errors


AI-assisted analysis of hmjz100/LinkSwift@417ea5e28a (2026-09-02). Data as JSON: /api/errors/92231873370ed0a8. Report an issue: GitHub.