vsivsi / meteor-file-collection

Extends Meteor Collections to handle file data using MongoDB gridFS.
http://atmospherejs.com/vsivsi/file-collection
Other
159 stars 37 forks source link

Error 404 in browser console #82

Closed mzygmunt closed 8 years ago

mzygmunt commented 8 years ago

Hello, Thank you for your hard work on File-Collection! Everything works great, except for the display of 404 in the console for each chunk. I know that this is correct and the file is saved, but the console is unnecessarily cluttered. Is it possible to do something about it? My FC version is 1.3.0 and Meteor 1.2.1 without any additional packages.

zrzut ekranu 2016-01-31 o 10 15 53

vsivsi commented 8 years ago

Hi, what version of file-collection are you using?

The last few versions return 204 to indicate missing chunks to resumable.js, and 204 doesn't log to the console. See: https://github.com/vsivsi/meteor-file-collection/blob/master/src/resumable_server.coffee#L244

If you are using the latest version, then I have no idea where that 404 is coming from.

mzygmunt commented 8 years ago

I'm using latest 1.3.0 version.

vsivsi commented 8 years ago

I just reconfirmed using the file-collection sample app that no 404 errors are logged to the browser console when using 1.3.0 to upload files. Something must be different about your app.

I suggest you try the sample app yourself and confirm that 1.3.0 doesn't log 404s on your own system.

mzygmunt commented 8 years ago

I solved my problem. I defined the collection in this way:

myFiles = new FileCollection('myFiles',
  { resumable: true,
    http: [
      { method: 'get',
        path: '/:md5',
        lookup: function (params, query) {
          return { md5: params.md5 };
        }
      }
    ]
  }
);

and it should be like this:

myFiles = new FileCollection('myFiles',
  { resumable: true,
    http: [
      { method: 'get',
        path: '/md5/:md5', //changed
        lookup: function (params, query) {
          return { md5: params.md5 }; 
        }
      }
    ]
  }
);
vsivsi commented 8 years ago

Glad you found the issue!

vsivsi commented 8 years ago

FYI, you weren't crazy, this appears to be a route precedence issue with the built-in resumable support. See: https://github.com/vsivsi/meteor-file-collection/issues/84

vsivsi commented 8 years ago

See https://github.com/vsivsi/meteor-file-collection/issues/84#issuecomment-178949348 for my proposed fix, on the dev branch now.

vsivsi commented 8 years ago

Fixed in 1.3.1