Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Markdown URL with &noprocess flag

Started by Claud Rusnac 4 years ago · 5 replies · 355 views
4 years ago

Markdown is manipulating my URL even though I add the &noprocess flag.

my URL [Link Here](https://sampledomain.com/?q=page/test-page-16779&noprocess)
what is being returned https://sampledomain.com/?q=page%2test-page-16779

last edited 12/01/22 by Claud Rusnac
4 years ago

@crusnac, What result are you hoping to get?

4 years ago

I am hoping to get https://sampledomain.com/?q=page/test-page-16779

the / in page/test-page-16779 is being replaced with %2 see page%2test-page-16779

4 years ago

@crusnac, Yes, I got that...

I'm afraid my question was a bit confusing... I was hoping for some more information because I don't know how you interpret the given url, what you are expecting and what in your mind the problem is.

  • You might have made a typo in ?q=page%2test-page-16779, while url encoding should result in ?q=page%2Ftest-page-16779. Notice your %2 vs %2F.
  • You might NOT have made a typo in ?q=page%2test-page-16779.
  • You might be expecting that ?q=page is the query, and /test-page-16779 is a path to a page.
  • You might be expecting that ?q=page/test-page-16779 is the query.
  • You might be expecting that ?q=page%2Ftest-page-16779 will be misinterpreted by the server.
  • You might be expecting that &noprocess would not encode the / into %2F
  • You might just find ?q=page%2Ftest-page-16779 to be ugly.
  • ...
last edited 12/02/22 by pamtbaau
4 years ago

Yes, sorry. My url is https://sampledomain.com/?q=page/test-page-16779 (cleansed for security reasons).

When I use the url above in a document [Link Here](https://sampledomain.com/?q=page/test-page-16779&noprocess), Grav manipulates it by encoding the / into %2F which makes the URL invalid.

Based upon the documentation adding a &noprocess shouldn't encode? Is this a bug or am I missing something?

4 years ago

@crusnac,

Grav manipulates it by encoding the / into %2F which makes the URL invalid

A url with a query containing %2F isn't invalid.
Google, for example, turns a search for "invalid/url" into url https://www.google.com/search?q=invalid%2Furl...

What makes you think it is invalid? Did you get an error somewhere?

Based upon the documentation adding a &noprocess shouldn’t encode?

I presume you're referring to subjects Skip all attributes and Skip certain attributes from the Link attributes section.

It doesn't say anything about url-encoding, but only that using &noprocess, all/certain attributes in the provided link will not be extracted into attributes in <a> elements. Like ?classes=underline for example.

See the code that transforms the Markdown link into an anchor element: Excerpts.php::processLinkExcerpt(). It is line 142 using PHP function http_build_query() that converts the / into %2F in the query part of the link.

last edited 12/02/22 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 53 10 hours ago
Support · by Anna, 3 days ago
2 60 13 hours ago
Support · by Justin Young, 14 hours ago
1 30 14 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 56 5 days ago