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

gridfs url conflicts with the flow router #2

Closed
kalmanh opened this issue Jun 10, 2016 · 2 comments
Closed

gridfs url conflicts with the flow router #2

kalmanh opened this issue Jun 10, 2016 · 2 comments

Comments

@kalmanh
Copy link

kalmanh commented Jun 10, 2016

@brucejo75 if you are planning on expanding this sample app, here is an issue that's probably worth including. (I myself just ran into this)

meteor-file-collection is able to setup a way to download files via 'http'. The problem is that if you are using Flow Router in your application, the Flow Router will blatantly disregard anything that's not specified as a route of Flow Router. So, when you click on an image or file to download - it will throw a (client-side) 404. To get around this issue, you need to specify target='_self' or download='filename'as an attribute on the URL (alongside the href attribute) and then Flow Router will leave you alone.

Here is the actual back and forth from the Flow Router guys

kadirahq/flow-router#235

Hoping this is useful to whoever runs into this issue :)

@brucejo75
Copy link
Owner

Thanks Kalman!

I added the target attribute in the sample. Although, the sample does not seem to have this issue.

I was having the issue on my application too, I figured I would investigate later. You probably saved me an hour or 2 tracking it down. thanks!

Also as part of my checkin I added an extension to file-collection findOneFile which is a synchronous read of the file. Super useful for me. Maybe you will find it useful too.

@kalmanh
Copy link
Author

kalmanh commented Jun 10, 2016

The reason the sample doesn't have the issue is because the sample app is not using a router (https://github.com/brucejo75/meteor-file-jsSample-app/blob/master/.meteor/packages) If you add the kadira:flow-router package and define Flow Router routes - the issue should be there (if you don't use target='_self')

Also, now that I looked around a little more, download='filename' (as an attribute inside the a element) is probably a better option than using target='_self'because it serves as a suggestion for what the filename should be based on the value inside the download attribute

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

2 participants