Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

BUG - Files Query using filename: not returning EXACT match.

BUG - Files Query using filename: not returning EXACT match.

Jason27
Shopify Partner
113 3 44

If I have a few files stored in my admin that have a HASH string added (usually by shopify), then the filename query fails to find the non-hashed file in one call.

 

For example I have these in /files (in this order):

1508558029453_6421E730-6560-43BF-8C68-F32687F7AD66.jpg

1508558029453.jpg

1508558029453_6341E077-4DA3-4D7D-B37C-579C7743F48A.jpg

 

And then if I run the following graphql, it will not return the single file I want: (it fetches all of the above files)

 

{files(first: 1,query: "filename:1508558029453.jpg") {
            edges {
                cursor
                node {
                    alt
                    createdAt
                    ... on MediaImage {
                        id
                        image {
                            id
                            width
                            height
                            src
                            altText
                        }
                    }
                }
            }
            pageInfo {
                hasNextPage
            }
        }
    }

 

From the Shopify documentation: (https://shopify.dev/api/usage/search-syntax)

 

- When using the ":" Equality symbol, the search query string must match the searched field exactly.

 

Why then would it return the filenames that also contain the HASH strings? Why are they considered exact matches?

 

I am supposed to page across all of the results to find the exact file I want? Does the inverse hold true if I search a filename with a hash, it will return the non-hashed matching file, or the different hashed files as well? So in any case, this fails a logic test, right?

Replies 0 (0)