I made a mistake & need help to recover from it, if at all possible

25 views
Skip to first unread message

Didier Gasser-Morlay

unread,
Apr 4, 2019, 5:29:09 AM4/4/19
to Fat-Free Framework
Hello,
Context

I use f3 to send dalily emails to a several groups of people (all subscribers, thsi is not a spam campaign!)  , each individual receives a personalised email, not only just the name and greetings but also an individualised link to get more detailed information. The email are generated using the Templates mechanism all works well. 

a few days ago I, by mistake, altered the template and replaced the original (working) link from 

www.whatever.com/view?a=xxxx, b=yyyyy

to 

www.whatever.com//view?a=xxxx, b=yyyyy

(note the double slash)

so when the receiver click on the link, he/she gets a Not Found error. Because of all the individualisation of each email, it is fairly difficult, if not impossible, to resend the last 3 days worth of emails 

so my question

is it possible to get F3, when decoding the url, to ignore the fact that there can be a double slash. Going by myself in altering F3 is a tad too involved for me, esp considering that time to solve this is quite limited

Thanks in advance for your help

Paul Herring

unread,
Apr 4, 2019, 7:11:38 AM4/4/19
to Didier Gasser-Morlay via Fat-Free Framework, Fat-Free Framework
Simply duplicating the exsitng route, with the URL with a double / should be sufficient (depending on what the current function does with the URL before the ?, if anything - it normally wouldn't I would have thought):

Given:

$ cat index.php
<?php
$f3 = require('f3/lib/base.php');

function view_function($f3){
        // as a demonstration, show what URI was passed in...
        echo $f3->SERVER['REQUEST_URI']."\n";
}
$f3->route('GET /', function($f3) { echo "/\n";});
$f3->route('GET /view', 'view_function');
$f3->route('GET //view', 'view_function'); // duplicate to fix 'problem'
$f3->run();

Main as an example:

The 'right' URL:

Doubled /:

--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/20bd644b-e419-41ad-b491-fae39fd9a894%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
PJH

Didier Gasser-Morlay

unread,
Apr 4, 2019, 9:05:34 AM4/4/19
to Fat-Free Framework
@PJH

Thanks a lot, easiests solutions are always best, I never thought about adding a route with a double slash, and that works fine.

This gives me some other headaches but these are solvable easily since it's my own code. (I indeed check the URL with a MD5 control which now fails ... but that's a minor issue)

Thanks again
Reply all
Reply to author
Forward
0 new messages