Zum Inhalt der Seite gehen


How to add a route with special characters?


!Friendica Developers I just wanted to implemented some more Mastodon API endpoint: https://docs.joinmastodon.org/methods/tags/

So I added this endpoint: /tags/{hashtag} - but this doesn't seem to cover any url like /api/v1/tags/%23PVgegenPutin The % is the problem here. How has the route definition has to be defined?
Als Antwort auf Michael Vogel

@Michael Vogel I don't know, but I'm surprised that you include the # in the hashtag (as %23). The examples seem to suggest the hashtag name is without the # symbol.
Als Antwort auf Hypolite Petovan

I now realized that the problem isn't caused by the router. It's at the beginning where the pagename variable is set. I hope that you can solve this.
Als Antwort auf Michael Vogel

@Michael Vogel It looks like we need to add the B flag to the RewriteRule statment in the .htaccess file.

Not sure about nginx though.

Friendica Developers hat dies geteilt.

Als Antwort auf Hypolite Petovan

@Michael Vogel I just confirmed the B flag does the trick. You need to update the .htaccess-dist file and we'll need to add this change to the release notes because it needs to be applied to production files that we do not control (ping @Tobias )
Als Antwort auf Hypolite Petovan

@Hypolite Petovan just place a note in the CHANGELOG file about it. As a reminder for the release notes and admins in the develop branch to find the information.
Als Antwort auf Hypolite Petovan

My Instances run on nginx. Just tell my what I can check for you :-)

Friendica Developers hat dies geteilt.

Als Antwort auf Marek Bachmann

@Marek Bachmann :friendica: @utzer ~Friendica~ What happens when you navigate to the following URL: https://friendica.mbbit.de/calendar/%23notfound

If you see your own calendar, nginx needs a fix for URL-encoding the pagename parameter when rewriting URL. If you see a "Not Found" error page, it's working as expected.

Friendica Developers hat dies geteilt.

Als Antwort auf Hypolite Petovan

Can you provide a PR? I'm not sure where to add this B here:
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
Als Antwort auf Michael Vogel

@Michael Vogel Here you go:
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA,B]
Unbekannter Ursprungsbeitrag

Hypolite Petovan
@Tobias Thank you for checking! It seems only Apache needed a change then.

Friendica Developers hat dies geteilt.