Is there an easy way to determine if a File Reference is local to the app?

I have a set of File References in the database, some of which are local to the app (actual files), and some of which are remote (URLs).

Is there an easy way for me to test/check if the File References are actual files or not, without doing API calls to the filesystem? I was thinking checking if the reference contains the API URL, but that is not used. I can regex my way through that API URL and match on the App ID, but I have a feeling there is an easier way… :slight_smile:

Hello @Egil_Helland,

The File Reference value returns URLs using the following logic:

Therefore, if you know how you made the request, you can check whether the returned file URL starts with your domain or not.

Thanks Stanislaw,

I ended up writing a simple regex, since I don’t necessarily know the domain, but verifying that the App ID is the same as for the API URL.

Screenshot for reference, if anyone needs to do something similar:

1 Like