New Shopify Certification now available: Liquid Storefronts for Theme Developers

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

Jason27
Shopify Partner
106 3 35

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)