Open c100k opened 7 years ago
Sounds like the invalid source comes from a 404 error page that sends status 200. In this case, that'd rather be a webserver configuration issue.
I found absolute paths to work as a work-around for now.
How do you get the absolute path? @asciifaceman
Typically you would be in control of the location of the file. On an osx terminal or linux CLI you should be able to use pwd
in the directory of the file and then append the file name. The absolute path is just the path to the file from the root directory, or /
on linux.
thanks ,such as,protoBuf.load("/Users/sys/shop/data.json"); it's fine but,How do you write when you pack? @asciifaceman
Ok, so absolute path works but its worthless on mobile app. I was lucky enough that my backend developer provided me link to the same file on web site. So https link inside worked, but i doubt that this is the best idea ever
if you have a link then the path is irrelevant. Don't confuse the issue,
protobuf.js version: 6.8.0 (in a React Native app)
Expected
Throw a meaningful error when the file is not found
Actual behavior
It starts parsing and throws an incomprehensible error
Code snippet
Stacktrace
After some investigation, in
root.js
we have :So maybe it is a bug in
fetch
that does not consider not finding the file as an error ? Also, what should be the path (absolute or relative) when we load a file in a React Native app ?