Last modified: 2006-12-13 19:03:58 UTC
Don't remember with whom I had the discussion, but I have gone implementing the abillity to soecify relative paths in #ifexist not (see following patch), It's mostly based on Parser.php p. 1860 ff. but made some modifications that I felt was good.
Created attachment 2768 [details] the implementation details
That error message text is ridiculous.
(In reply to comment #2) > That error message text is ridiculous. I didn't know what to write, so I wrote what first came into my mind. If you have a better solution, please feel free to contribute.
"If in NS_MEDIA, check against actual file"
(In reply to comment #4) > "If in NS_MEDIA, check against actual file" Thats not this issue I think. (this bug report is separate from the Image bug 7985)
Well, sort that one out as well, then. Try something like "Error: Invalid path" or "Error: Invalid path depth".
(In reply to comment #6) > Well, sort that one out as well, then. Try something like "Error: Invalid path" > or "Error: Invalid path depth". They are sorted out, they have nothing to do with each other. I'll make the change to the error message.
Created attachment 2770 [details] implementation of the functionallity As requested by Rob Church, I have changed the error message, also added some extra whitespaces to the code and added some comments.
Created attachment 2775 [details] reimplementation of the patch I decided to totally rewamp the design, to be able to handle more strange path constructs, like for example: "../../Flubb/../Baz/../mamma/pappa/barn/../../mamma"
Do we really need to support "strange path constructs" to this extent? There's being flexible about it, and implementing it to a stupid level; we can reasonably demand that users don't try to do fucked up things with this.
(In reply to comment #10) > Do we really need to support "strange path constructs" to this extent? There's > being flexible about it, and implementing it to a stupid level; we can > reasonably demand that users don't try to do fucked up things with this. The cases I had in mind was "foo/../bar" and "foo/.."
Your example implied otherwise.
(In reply to comment #12) > Your example implied otherwise. sorry, I just copied my test-string. On a not, just thought it might be better to separate the code to a new function {{#rel2abs:}} or simlar
Created attachment 2776 [details] the new patch As I suggested to my self earlier, I decided to move the code to an new function called 'rel2abs' that will return an absolute path from an relative one. (Thus it can be used for more)
Created attachment 2783 [details] the patch, updated minor Just forgot to remove the level check in the while statement, as it's unnecessary
Created attachment 2784 [details] the patch again I was thinking a bit wrong there, we can't just count the number of levels, we need to check that we won't go above root.
Created attachment 2785 [details] possibly final patch changed the implementation to use push, pop and unshift instead.
Created attachment 2786 [details] the last patch a bugfix only
Committed by Tim with substantial modification in r17979.
Created attachment 2791 [details] some minor modifications sure I forgot something earlier
Created attachment 2796 [details] minor modifications should probably trim $from first.