diff --git a/DysonNetwork.Sphere/Storage/FileService.cs b/DysonNetwork.Sphere/Storage/FileService.cs index 896925a..593ed17 100644 --- a/DysonNetwork.Sphere/Storage/FileService.cs +++ b/DysonNetwork.Sphere/Storage/FileService.cs @@ -118,6 +118,11 @@ public class FileService( foreach (var field in vipsImage.GetFields()) { var value = vipsImage.Get(field); + + // Skip GPS-related EXIF fields to remove location data + if (IsGpsExifField(field)) + continue; + exif.Add(field, value); if (field == "orientation") orientation = (int)value; } @@ -497,4 +502,41 @@ public class FileService( .Where(r => r.FileId == fileId) .AnyAsync(); } + + /// + /// Checks if an EXIF field contains GPS location data + /// + /// The EXIF field name + /// True if the field contains GPS data, false otherwise + private static bool IsGpsExifField(string fieldName) + { + // Common GPS EXIF field names + var gpsFields = new[] + { + "gps-latitude", + "gps-longitude", + "gps-altitude", + "gps-latitude-ref", + "gps-longitude-ref", + "gps-altitude-ref", + "gps-timestamp", + "gps-datestamp", + "gps-speed", + "gps-speed-ref", + "gps-track", + "gps-track-ref", + "gps-img-direction", + "gps-img-direction-ref", + "gps-dest-latitude", + "gps-dest-longitude", + "gps-dest-latitude-ref", + "gps-dest-longitude-ref", + "gps-processing-method", + "gps-area-information" + }; + + return gpsFields.Any(gpsField => + fieldName.Equals(gpsField, StringComparison.OrdinalIgnoreCase) || + fieldName.StartsWith("gps", StringComparison.OrdinalIgnoreCase)); + } } \ No newline at end of file