octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49228] imread should only read from a URL if


From: Rik
Subject: [Octave-bug-tracker] [bug #49228] imread should only read from a URL if name looks like a URL, only read from a local file otherwise
Date: Wed, 16 Nov 2016 19:26:29 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #6, bug #49228 (project octave):

This seems easy enough to fix with a regular expression.  The question is what
should the regexp be?

According to https://en.wikipedia.org/wiki/URI_scheme, the most basic form is


scheme:[//[user:address@hidden:port]][/]path[?query][#fragment]


The double forward slash is required by some schemes and not by others, so it
can't necessary be used in the regexp.

Because we operate on Windows now, we also have to avoid interping a drive
letter specification as a URI scheme.  For example,


C:\windows


which is definitely a path on the local machine.  After checking with
Microsoft itself
(https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx).
 It seems that a drive letter is always a single character.

A possible regexp for testing is


fname
is_url = ! isempty (regexp (fname, '^[a-zA-Z][a-zA-Z0-9.+-]+:'));




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49228>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]