plugins icon indicating copy to clipboard operation
plugins copied to clipboard

bug(gatsby-source-airtable): Duplicate Dot in File Extension

Open roNn23 opened this issue 1 year ago • 4 comments

Describe the bug

When creating a RemoteFileNode, there seems to be an issue with the file extension having a duplicate dot. This is due to the way the extension is being appended in the code.

The code:

ext: extension ? `.${extension}` : undefined,

results in a double dot before the file extension, e.g., ..jpg, since the extension variable already contains a dot.

Expected behavior

The file extension should only have one dot before it, e.g., .jpg.

Solution:

To fix this, the dot before extension in the template literal can be removed:

ext: extension || undefined

Here is the code line: https://github.com/gatsby-uc/plugins/blob/b7b48b781885a7b0378bb44f18ee18b0733a3981/packages/gatsby-source-airtable/gatsby-node.js#L309

roNn23 avatar Sep 11 '23 14:09 roNn23

Hey! Thanks for the report. You interested in submitting a PR?

moonmeister avatar Sep 21 '23 22:09 moonmeister

Ps, if you look at line 300 it looks like 309 is a duplicate of this line. So no undefined check may be needed.

moonmeister avatar Sep 21 '23 22:09 moonmeister

@moonmeister Can you assign this to me? I will raise the PR

239yash avatar Sep 22 '23 03:09 239yash

@moonmeister Please review this PR. We can simplify this further

239yash avatar Sep 22 '23 13:09 239yash