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

Foreign directory listings cause JavaScript error #9

Open
gflohr opened this issue Mar 16, 2015 · 0 comments
Open

Foreign directory listings cause JavaScript error #9

gflohr opened this issue Mar 16, 2015 · 0 comments

Comments

@gflohr
Copy link

gflohr commented Mar 16, 2015

I mistakenly reported this issue as a bug of ngx-fancyindex before (aperezdc/ngx-fancyindex#21):

You cannot navigate into a directory that is not handled by fancyindex. The error is caused by history.js:

var elements = div.getElementsByClassName('box-content')[0];
target.innerHTML = elements.innerHTML;

The html of "div" is the content of the directory listing. But this listing may not be generated by fancyindex, so that "elements" is null, and accessing the property innerHTML will trigger an exception.

I fixed that by setting the location and returning false in case "elements" is null.

A somewhat better approach would be to let fancyindex send a custom header and check that header instead of relying on the presence of an element with the class name 'box-content". And the best fix would be to not fire the ajax request at all if a link points to a location that is not handled by fancyindex.

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