Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URI.isDirectory is broken #166

Open
LexLythius opened this issue May 27, 2011 · 0 comments
Open

URI.isDirectory is broken #166

LexLythius opened this issue May 27, 2011 · 0 comments

Comments

@LexLythius
Copy link

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 added a commit to sangupta/as3corelib that referenced this issue Apr 30, 2012
rzubek pushed a commit to rzubek/as3corelib that referenced this issue Mar 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant