Last modified: 2006-12-13 19:03:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T10021, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8021 - new parser function to convert relative path to absolute path
new parser function to convert relative path to absolute path
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: need-parsertest, patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-23 19:48 UTC by Carl Fürstenberg
Modified: 2006-12-13 19:03 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
the implementation details (1.41 KB, patch)
2006-11-23 19:49 UTC, Carl Fürstenberg
Details
implementation of the functionallity (1.59 KB, patch)
2006-11-23 21:28 UTC, Carl Fürstenberg
Details
reimplementation of the patch (2.08 KB, patch)
2006-11-24 19:42 UTC, Carl Fürstenberg
Details
the new patch (3.03 KB, patch)
2006-11-24 21:28 UTC, Carl Fürstenberg
Details
the patch, updated minor (2.88 KB, patch)
2006-11-26 15:22 UTC, Carl Fürstenberg
Details
the patch again (2.92 KB, patch)
2006-11-26 15:32 UTC, Carl Fürstenberg
Details
possibly final patch (2.95 KB, patch)
2006-11-26 15:53 UTC, Carl Fürstenberg
Details
the last patch (3.09 KB, patch)
2006-11-26 16:09 UTC, Carl Fürstenberg
Details
some minor modifications (1003 bytes, patch)
2006-11-28 19:12 UTC, Carl Fürstenberg
Details
minor modifications (1.00 KB, patch)
2006-11-29 14:06 UTC, Carl Fürstenberg
Details

Description Carl Fürstenberg 2006-11-23 19:48:44 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.
Comment 1 Carl Fürstenberg 2006-11-23 19:49:06 UTC
Created attachment 2768 [details]
the implementation details
Comment 2 Rob Church 2006-11-23 21:04:56 UTC
That error message text is ridiculous.
Comment 3 Carl Fürstenberg 2006-11-23 21:14:32 UTC
(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.
Comment 4 Rob Church 2006-11-23 21:15:09 UTC
"If in NS_MEDIA, check against actual file"
Comment 5 Carl Fürstenberg 2006-11-23 21:17:13 UTC
(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)
Comment 6 Rob Church 2006-11-23 21:20:24 UTC
Well, sort that one out as well, then. Try something like "Error: Invalid path"
or "Error: Invalid path depth".
Comment 7 Carl Fürstenberg 2006-11-23 21:22:18 UTC
(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.
Comment 8 Carl Fürstenberg 2006-11-23 21:28:59 UTC
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.
Comment 9 Carl Fürstenberg 2006-11-24 19:42:38 UTC
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"
Comment 10 Rob Church 2006-11-24 20:16:24 UTC
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.
Comment 11 Carl Fürstenberg 2006-11-24 20:19:18 UTC
(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/.."
Comment 12 Rob Church 2006-11-24 20:20:32 UTC
Your example implied otherwise.
Comment 13 Carl Fürstenberg 2006-11-24 20:23:44 UTC
(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
Comment 14 Carl Fürstenberg 2006-11-24 21:28:25 UTC
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)
Comment 15 Carl Fürstenberg 2006-11-26 15:22:11 UTC
Created attachment 2783 [details]
the patch, updated minor

Just forgot to remove the level check in the while statement, as it's
unnecessary
Comment 16 Carl Fürstenberg 2006-11-26 15:32:03 UTC
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.
Comment 17 Carl Fürstenberg 2006-11-26 15:53:16 UTC
Created attachment 2785 [details]
possibly final patch

changed the implementation to use push, pop and unshift instead.
Comment 18 Carl Fürstenberg 2006-11-26 16:09:20 UTC
Created attachment 2786 [details]
the last patch

a bugfix only
Comment 19 Aryeh Gregor (not reading bugmail, please e-mail directly) 2006-11-28 17:40:25 UTC
Committed by Tim with substantial modification in r17979.
Comment 20 Carl Fürstenberg 2006-11-28 19:12:35 UTC
Created attachment 2791 [details]
some minor modifications

sure I forgot something earlier
Comment 21 Carl Fürstenberg 2006-11-29 14:06:04 UTC
Created attachment 2796 [details]
minor modifications

should probably trim $from first.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links