-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Images with a filename ending in "..." are not given the right extension when mapping to a fileNode #170
Comments
This is some great work 👏 . Thanks for the effort ❤️ . I guess I have two thoughts about this. It feels like it would be good to deal with in That being said, if Airtable is correctly sending the ext, it may be worth passing that as well. I can't think of any downside to passing it through. It would probably be considered a bugfix as I don't expect it to break anyone downstream for this library. My one thought would be to conditionally include it as opposed to always passing it with a value (of which one of those values could be |
Thanks! :) I didn't say anything before, but really appreciate the work you've done with this package 👌 I agree something should be changed in Regarding things we can do here, I'll open a PR using node mime to get the extension from the mime type provided by airtable. We can then pass the |
Curious as it isn't quite clear, do you know from where the ellipsis is coming. Is this something that Airtable is sending over? I have seen some reports of the cache being a problem, and part of me wonders if this is a root cause if it is using the same logic to pull from the cache. |
Correct, Airtable sends an ellipsized filename when the name of the uploaded file is longer than a threshold. Not sure what that threshold is or why they decided to remove the extension from the filename. Do you have an issue at hand that reports cache being a problem? I can have a look at their problems and tell you if I've seen the same issues due to the ellipsis. Regarding this issue, I'm happy if you want to close it since #172 was merged. Also happy if you want to keep it open to track the potential relation with the cache issues |
This issue has been automatically marked as stale because it has not had any recent activity for 30 days. It will be closed if no further activity occurs within 7 days. Remove stale label, comment, and/or apply "ongoing issue" label to prevent this from being closed. Thank you for your contributions. |
I'll close this issue. Fixed by #172 |
Working with @carletex on a project we were hitting a problem trying to use images from airtable using
gastby-image
. We dug a bit and found the root cause. I'll try to describe here what we found out so we can discuss if the problem comes from this repo orgatsby-source-filesystem
.Problem
There are 3 possible scenarios –as far as we know– for filenames:
attachment.jpg
The name of the attachment
A very long name for my attach...
Attachments with ellipsized names will result in the fileNode not having the right extension. The other two cases will successfully be created with the right extension.
Root cause
We rely on
gatsby-source-filesystem
to figure out the file extension, even when we have the mime type of the attachment in the payload we get from airtable. In gatsby-node, line 303, we're callingcreateRemoteFileNode
fromgatsby-source-filesystem
, but we don't send theext
argument.Possible solutions
We thought about two possible solutions for this issue:
gatsby-source-filesystem
figures out the extension of the file. Edit: I opened gatsby-source-filesystem returns '.' as the extension when the url ends in '...' gatsbyjs/gatsby#22463 to track this optionext
property when we callcreateRemoteFileNode
. We could use a library like Node mime, that would add 2.5kb to the package size if we use the lite version.Temporary hack
We implemented something like the following, but this is just a hack that solves for our use case. That would replace the call to
createRemoteFileNode
in gatsby-node line 303What are maintainer thoughts about next steps?
The text was updated successfully, but these errors were encountered: