Skip to content

Fixed: escape '/' in preg_quote of asset tag prefix #16542

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

Open
wants to merge 45 commits into
base: develop
Choose a base branch
from

Conversation

mrdahbi
Copy link

@mrdahbi mrdahbi commented Mar 20, 2025

This resolves the issue I encountered in version 8 of snipe-it (8.0.4)

When using a prefix with forward slash, preg_quote without arguments fails to escape it and results in error in Javascript console while trying for example to create a new asset.

Here's the original error:
missing after parenthesis Uncaught SyntaxError: missing ) source: create:1303:64
which points to the same line fixed in edit.blade.php

snipe added 30 commits February 25, 2025 12:18
Signed-off-by: snipe <[email protected]>
Signed-off-by: snipe <[email protected]>

# Conflicts:
#	config/version.php
Signed-off-by: snipe <[email protected]>

# Conflicts:
#	config/version.php
snipe and others added 15 commits March 4, 2025 23:30
Signed-off-by: snipe <[email protected]>
Signed-off-by: snipe <[email protected]>

# Conflicts:
#	public/css/dist/skins/_all-skins.css
#	public/css/dist/skins/_all-skins.min.css
#	public/css/dist/skins/skin-blue.css
#	public/css/dist/skins/skin-blue.min.css
#	public/mix-manifest.json
Signed-off-by: snipe <[email protected]>

# Conflicts:
#	config/version.php
Signed-off-by: snipe <[email protected]>

# Conflicts:
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/js/build/app.js
#	public/js/dist/all.js
#	public/mix-manifest.json
When using a prefix with forward slash, preg_quote without arguments fails to escape it and results in error in javascript console while trying for example to create a new asset.
@mrdahbi mrdahbi requested a review from snipe as a code owner March 20, 2025 12:28
Copy link

welcome bot commented Mar 20, 2025

💖 Thanks for this pull request! 💖

We use semantic commit messages to streamline the release process and easily generate changelogs between versions. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix if it doesn't have one already.

Examples of commit messages with semantic prefixes:

  • Fixed #<issue number>: don't overwrite prevent_default if default wasn't prevented
  • Added #<issue number>: add checkout functionality to assets
  • Improved Asset Checkout: use new notification method for checkout

Things that will help get your PR across the finish line:

  • Document any user-facing changes you've made.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

Copy link

what-the-diff bot commented Mar 20, 2025

PR Summary

  • Improved JavaScript Function Accuracy
    The update to the JavaScript function allows it to process additional information, improving the accuracy of its tasks. The specific change involves the addition of a second parameter in a technical process called preg_quote, ensuring any automatically added prefixes are properly recognized and handled. This means our software will behave more predictably and cleanly when dealing with sequences generated by the system.

@mrdahbi mrdahbi changed the title Update edit.blade.php: escape '/' in preg_quote Fixed: escape '/' in preg_quote of asset tag prefix Mar 20, 2025
@snipe
Copy link
Member

snipe commented Apr 8, 2025

Hi there - thanks for this! Can you please re-target this PR to point to the develop branch, per our Contributing documentation?

You usually don't need to close and re-open. After you create a pull request, you can modify the base branch so that the changes in the pull request are compared against a different branch. By changing the base branch of your original pull request rather than opening a new one with the correct base branch, you’ll be able to keep valuable work and discussion.

mhuxq

Thanks!

@mrdahbi mrdahbi changed the base branch from master to develop April 8, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants