Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

URI.isDirectory is broken #166

Open
LexLythius opened this Issue · 0 comments

1 participant

@LexLythius

This line (638) in URI's isDirectory method:
return (_path.charAt(path.length - 1) == '/');
should be
return (_path.charAt(_path.length - 1) == '/');

Since field _path is escaped but property path is not, for every URI that has escaped characters, charAt will pick a character somewhere in the middle of the string (not at the end) and then see if that character is a slash--which it might be. When that happens, isDirectory returns the wrong result, breaking in turn getFilename, getExtension and isOfFileType methods.

This code:
var u:URI = new URI();
u.unknownToURI("C:\\a b c d\\ab.swf");
trace(u.toString() + " isDir=" + u.isDirectory());

yields
http://c/a%20b%20c%20d/ab.swf isDir=true

I don't have permissions to commit the fix.

@sangupta sangupta referenced this issue from a commit in sangupta/as3corelib
@sangupta sangupta fix for issue #166 from original fork. 1747557
@rzubek rzubek referenced this issue from a commit in rzubek/as3corelib
@sangupta sangupta fix for issue #166 from original fork. 91155c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.