-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix path matching in getResourceType to handle relative paths #691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes getResourceType() path classification so deep links using relative paths (stored in the URL hash) correctly detect hook and skill resources, restoring expected modal behavior.
Changes:
- Update skills path detection to match both relative (
skills/...) and absolute (/skills/...) paths. - Update hooks path detection to match both relative (
hooks/...) and absolute (/hooks/...) paths.
| if (filePath.endsWith(".agent.md")) return "agent"; | ||
| if (filePath.endsWith(".prompt.md")) return "prompt"; | ||
| if (filePath.endsWith(".instructions.md")) return "instruction"; | ||
| if (filePath.includes("/skills/") && filePath.endsWith("SKILL.md")) | ||
| if (/(^|\/)skills\//.test(filePath) && filePath.endsWith("SKILL.md")) | ||
| return "skill"; |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getResourceType() returns "instruction" for .instructions.md, but the VS Code install config (VSCODE_INSTALL_CONFIG) is keyed by "instructions". In openFileModal(), getVSCodeInstallUrl(type, ...) will therefore return null for instruction files, hiding the install dropdown in the modal for instructions opened from the list or via deep link. Consider normalizing the type names (e.g., use "instructions" everywhere) or adding an alias mapping in getVSCodeInstallUrl so both "instruction" and "instructions" resolve to the same config entry.
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.Description
The
getResourceType()function used.includes("/hooks/")and.includes("/skills/")which failed to match relative paths stored in URL hashes (e.g.,hooks/pre-commit/README.md), causing deep links to classify resources as "unknown" and break modal behavior.Changes:
.includes("/hooks/")with regex/(^|\/)hooks\//.test()to match both relative and absolute pathsBefore:
After:
Pattern matches:
hooks/pre-commit/README.md✓/hooks/pre-commit/README.md✓Type of Contribution
Additional Notes
This PR addresses review feedback from #685: #685 (comment)
Merges into the
copilot/pr-685branch, notmain.By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.