I have a database (MS SQL 2019) where the customer saves files to certain records (Item images) unfortunately the file names haven't been saved with the data, so the file extension is unknown. To recover those files when needed, we wrote a detector that determines the extensions based on the header.
Now the strange thing is: We have a backup of the production server on our dev environment and the headers for like 85% of the files return different bytes than the the ones on the production server. But the kicker is: if I export the data into a file anyway and give both files the same extension (jpg) they both seem to be fine. - No corrupted data.
We built the detector based on this list: https://en.wikipedia.org/wiki/List_of_file_signatures
The header on the production server is not on that list (its A0 B9 A0 22
) and I'm really curious what is going on. I could just add the header but i want to know how this can even happen.
Thanks for your input
EDIT: apparently, it wasn't the data that changed, but the interpretation layer based on the server configuration. I still haven't found a proper explanation for the phenomenon. But I tested the records with management studio now, and the DB records HAVE the same value. Sorry to bother you.
I should've spent more time analyzing the issue. The database was restored unaltered. - Its the interpretation layer that does something odd due to different environments.