Skip to content
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

feat: add isScriptProtocol util #156

Merged
merged 6 commits into from
Jul 28, 2023
Merged

feat: add isScriptProtocol util #156

merged 6 commits into from
Jul 28, 2023

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

nuxt/nuxt#22366

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This allows checking for protocol existence with hasProtocol('https://test.com', { script: false }), in cases where we want to safely redirect to an external URL.

API thoughts welcome.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added the enhancement New feature or request label Jul 28, 2023
@danielroe danielroe requested a review from pi0 July 28, 2023 09:13
@danielroe danielroe self-assigned this Jul 28, 2023
src/utils.ts Outdated Show resolved Hide resolved
src/utils.ts Outdated Show resolved Hide resolved
src/utils.ts Outdated Show resolved Hide resolved
@pi0 pi0 changed the title feat(hasProtocol): allow disallowing script protocols feat: add isScriptProtocol util Jul 28, 2023
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #156 (3e080f2) into main (7fa45a0) will decrease coverage by 0.22%.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##             main     #156      +/-   ##
==========================================
- Coverage   94.86%   94.64%   -0.22%     
==========================================
  Files           7        7              
  Lines         798      803       +5     
  Branches      171      171              
==========================================
+ Hits          757      760       +3     
- Misses         41       43       +2     
Files Changed Coverage Ξ”
src/utils.ts 99.09% <60.00%> (-0.91%) ⬇️

src/utils.ts Show resolved Hide resolved
@pi0 pi0 merged commit b982937 into main Jul 28, 2023
1 check passed
@pi0 pi0 deleted the feat/script-protocol branch July 28, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants