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

Correct URL decoding of macro partial view names #6592

Merged
merged 2 commits into from
Oct 15, 2019

Conversation

stevemegson
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes #6590

Description

When picking a partial view in a macro's settings, the picker returns the filename URL-encoded. Any spaces are left encoded as +, and we store ~/Views/MacroPartials/Name+with+spaces.cshtml. Then when trying to render the macro, the file can't be found.

Testing:

  • Create a macro partial view with spaces in the name.
  • Create a macro and pick that partial view.
  • The filename should be displayed with spaces, not +.

@bjarnef
Copy link
Contributor

bjarnef commented Oct 6, 2019

Maybe it would be better to replace this unescape function instead since it is deprecated.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape

It is recommended to use either decodeURI or decodeURIComponent instead of unescape.

@stevemegson
Copy link
Contributor Author

Yeah, we should be using decodeURIComponent. It doesn't help with decoding +, but it handles Unicode properly.

@nul800sebastiaan
Copy link
Member

Cool, looks good, we'll have a look soon, thanks!

@bjarnef
Copy link
Contributor

bjarnef commented Oct 7, 2019

Maybe it is worth to wrap this in a function in one of the services?
https://stackoverflow.com/a/20247435

At the moment we are using this a few places.

A single place it use the underscore function to unescape.

@nul800sebastiaan
Copy link
Member

Works like a charm!

@stevemegson stevemegson deleted the v8/pr/6590 branch October 15, 2019 17:50
emmaburstow pushed a commit that referenced this pull request Oct 27, 2019
…ton (#6561)

* Improves accessability of the three dot tree options button

* Updated list view headers styling to have the link/hand cursor visible only if the header is sortable (and hence clicking has an effect)

* Allows members to be ordered by additional system fields (#6575)

* Fix ContentType.Alias matching in PublishedContentExtensions an… (#6577)

* Fixes an error in #6538 by moving the colon character to the sr-only span

* V8: Move misplaced colon in language selector (#6692)

* V8: It should be possible to disallow all types at content root (#6580)

* Pick macro parameters in an infinite editor like content type properties (#6586)

* Reload node children after publishing with descendants

* Correct URL decoding of macro partial view names (#6592)

* Fix semantics for list views (#6595)

* fixes test

* fixing tests

* Improved menu context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

V8: Creating a Macro Partial View in the backoffice with spaces in the name can't be used with a Macro.
3 participants