Sophie McCarrell
Sophie McCarrell

Reputation: 2871

How can I serve static images with spaces in the filename using Meteor?

I have an image in some subdirectories in my public folder and the ones without spaces in the name are served fine, but the ones with spaces redirect to the main page (which seems sorta dumb as it is [it should be a 404 if it isn't going to work right]).

An example of a working image: localhost:3003/magicimgs/M14/Blessing.jpg

An example of a non working image: localhost:3003/magicimgs/M14/Academy%20Raider.jpg

They both exist and work in the exact same app in the same folder structure, using backbone and angular.

Even troubleshooting steps would be great... I'm having a really difficult time navigating around Meteor. When things work, it's great, when they don't I have no way to troubleshoot it. thanks.

Folder structure:

|-client
|---hb_helpers
|---views
|-partials
|-private
|---magicsets
|-public
|---css
|---magicimgs
|-----M14
|-----m14 copy
|-server

Upvotes: 0

Views: 193

Answers (1)

Jonathan Warden
Jonathan Warden

Reputation: 2502

I honestly think you have found a bug, and your only solution until the bug is fixed is to rename your files and remove spaces.

There are two issues here:

  • the behavior of Meteor on missing pages -- taking you to the home page instead of a 404 page. This is a design decision, not a bug, but one that not everyone agrees with. There's a discussion on handling missing pages with meteor-router here, though it doesn't solve your problem.

  • Meteor handling of files without spaces. I tried this myself and the same thing happens for me -- Meteor as of version 0.6.5 just doesn't seem to handle spaces in file names correctly, at least when serving up files from /public.

Upvotes: 2

Related Questions