Skip to content

fix(uninstall): import url_filename from download.ps1#6530

Merged
niheaven merged 3 commits intoScoopInstaller:developfrom
xrgzs:fix/uninstall-url-filename
Nov 11, 2025
Merged

fix(uninstall): import url_filename from download.ps1#6530
niheaven merged 3 commits intoScoopInstaller:developfrom
xrgzs:fix/uninstall-url-filename

Conversation

@xrgzs
Copy link
Copy Markdown

@xrgzs xrgzs commented Oct 25, 2025

Description

Resolved missing import issue by importing the url_filename function from download.ps1.

Motivation and Context

Closes #6514

Relates to #6095
Relates to #6527

How Has This Been Tested?

At this moment, this only happens on the develop branch.

In my usage, the error occurs during the Invoke-Installer calls in libexec\scoop-uninstall.ps1, which depend on the url_filename function.

You can replicate by uninstall an app which uses the uninstaller.file and uninstaller.args. For example:

scoop config scoop_repo https://github.com/ScoopInstaller/Scoop
scoop config scoop_branch develop
scoop update
scoop install extras/hack-font
scoop uninstall hack-font
PS C:\Users\Admin> scoop uninstall hack-font
Uninstalling 'hack-font' (1.6.0).
url_filename : 无法将url_filename项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写 ,如果包括路径,请确保路径正确,然后再试一次。
所在位置 C:\Users\Admin\scoop\apps\scoop\current\lib\install.ps1:113 字符: 21
+             $Name = url_filename @(url $manifest $architecture)
+                     ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (url_filename:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

无法对 Null 数组进行索引。
所在位置 C:\Users\Admin\scoop\apps\scoop\current\lib\install.ps1:115 字符: 30
+         $progName = "$Path\$(coalesce $installer.file $Name[0])"
+                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [],RuntimeException
    + FullyQualifiedErrorId : NullArray

Running uninstaller ... error.
ERROR 使用0个参数调用Start时发生异常:Access is denied
Uninstallation aborted.

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

Summary by CodeRabbit

  • Chores
    • Uninstall process now has access to the download helper; no user-facing behavior changes.
    • Changelog updated to document the linkage between uninstall and the download helper.

Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 25, 2025

Walkthrough

Imported download.ps1 into libexec/scoop-uninstall.ps1 so the url_filename helper is available during uninstall; added an Unreleased changelog entry documenting the import.

Changes

Cohort / File(s) Summary
Uninstall script update
libexec/scoop-uninstall.ps1
Added an import of download.ps1 to expose the url_filename helper used when handling uninstallers with file or args fields.
Changelog
CHANGELOG.md
Added an Unreleased entry noting that uninstall now imports url_filename from download.ps1.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as scoop CLI
    participant Uninstall as libexec/scoop-uninstall.ps1
    participant Download as lib/download.ps1
    participant Install as lib/install.ps1

    CLI->>Uninstall: request uninstall <app>
    Note right of Uninstall `#D3E4CD`: import download.ps1 (new)
    Uninstall->>Download: call url_filename(urls...)
    Download-->>Uninstall: filename(s)
    Uninstall->>Install: resolve installer path using filename
    Install-->>Uninstall: uninstaller command / path
    Uninstall->>CLI: run uninstaller / report result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single small change (import) in one script plus changelog.
  • Review focus:
    • Correct import path and behavior on different shells/environments.
    • Ensure loading download.ps1 doesn't introduce unwanted globals or side effects.
    • Verify that url_filename is the intended helper and handles expected inputs.

Poem

🐰 I hopped through the scripts with a curious twitch,
Found a missing helper and stitched up the glitch.
I fetched names from URLs, tidy and spry,
Uninstall now hums — no more "not defined" cry. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely summarizes the main fix: importing url_filename from download.ps1 to resolve an uninstall error.
Linked Issues check ✅ Passed The changes directly address issue #6514 by importing url_filename from download.ps1 into scoop-uninstall.ps1, resolving the undefined function error that prevented uninstallers with file/args from working.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue: importing url_filename in uninstall and documenting the fix in CHANGELOG. No extraneous modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3eee8e5 and a64d144.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xrgzs
Copy link
Copy Markdown
Author

xrgzs commented Oct 25, 2025

@z-Fng

@niheaven
Copy link
Copy Markdown
Member

Please update the changelog

@niheaven niheaven merged commit 7399945 into ScoopInstaller:develop Nov 11, 2025
3 checks passed
@xrgzs xrgzs deleted the fix/uninstall-url-filename branch November 11, 2025 13:24
Deide pushed a commit to Deide/scoop that referenced this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants