🐛 Trying to prevent exiftool causing analyze failed
This commit is contained in:
		
							
								
								
									
										6
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
			
		||||
    <option name="autoReloadType" value="ALL" />
 | 
			
		||||
  </component>
 | 
			
		||||
  <component name="ChangeListManager">
 | 
			
		||||
    <list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":sparkles: Save EXIF into file metadata">
 | 
			
		||||
    <list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":zap: Use exif whitelist to prevent produce garbage data">
 | 
			
		||||
      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 | 
			
		||||
      <change beforePath="$PROJECT_DIR$/pkg/internal/services/analyzer.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/analyzer.go" afterDir="false" />
 | 
			
		||||
    </list>
 | 
			
		||||
@@ -117,7 +117,6 @@
 | 
			
		||||
    </option>
 | 
			
		||||
  </component>
 | 
			
		||||
  <component name="VcsManagerConfiguration">
 | 
			
		||||
    <MESSAGE value=":sparkles: Attachment has pool" />
 | 
			
		||||
    <MESSAGE value=":sparkles: Pool clean by lifecycle config" />
 | 
			
		||||
    <MESSAGE value=":recycle: Split mark and delete file" />
 | 
			
		||||
    <MESSAGE value=":bug: Fix migration issue on pools" />
 | 
			
		||||
@@ -142,7 +141,8 @@
 | 
			
		||||
    <MESSAGE value=":sparkles: Attachment API can edit metadata" />
 | 
			
		||||
    <MESSAGE value=":lock: Fix Attachment will contains GPS information" />
 | 
			
		||||
    <MESSAGE value=":sparkles: Save EXIF into file metadata" />
 | 
			
		||||
    <option name="LAST_COMMIT_MESSAGE" value=":sparkles: Save EXIF into file metadata" />
 | 
			
		||||
    <MESSAGE value=":zap: Use exif whitelist to prevent produce garbage data" />
 | 
			
		||||
    <option name="LAST_COMMIT_MESSAGE" value=":zap: Use exif whitelist to prevent produce garbage data" />
 | 
			
		||||
  </component>
 | 
			
		||||
  <component name="VgoProject">
 | 
			
		||||
    <settings-migrated>true</settings-migrated>
 | 
			
		||||
 
 | 
			
		||||
@@ -160,9 +160,7 @@ func AnalyzeAttachment(file models.Attachment) error {
 | 
			
		||||
 | 
			
		||||
			// Removing location EXIF data
 | 
			
		||||
			et, err := exiftool.NewExiftool()
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return fmt.Errorf("error when intializing exiftool: %v", err)
 | 
			
		||||
			}
 | 
			
		||||
			if err == nil {
 | 
			
		||||
				defer et.Close()
 | 
			
		||||
				exif := et.ExtractMetadata(dst)
 | 
			
		||||
				for _, data := range exif {
 | 
			
		||||
@@ -175,6 +173,7 @@ func AnalyzeAttachment(file models.Attachment) error {
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				et.WriteMetadata(exif)
 | 
			
		||||
			}
 | 
			
		||||
		case "video":
 | 
			
		||||
			// Dealing with video
 | 
			
		||||
			ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
 | 
			
		||||
@@ -202,9 +201,7 @@ func AnalyzeAttachment(file models.Attachment) error {
 | 
			
		||||
 | 
			
		||||
			// Removing location EXIF data
 | 
			
		||||
			et, err := exiftool.NewExiftool()
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return fmt.Errorf("error when intializing exiftool: %v", err)
 | 
			
		||||
			}
 | 
			
		||||
			if err == nil {
 | 
			
		||||
				defer et.Close()
 | 
			
		||||
				exif := et.ExtractMetadata(dst)
 | 
			
		||||
				for _, data := range exif {
 | 
			
		||||
@@ -219,6 +216,7 @@ func AnalyzeAttachment(file models.Attachment) error {
 | 
			
		||||
				et.WriteMetadata(exif)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tx := database.C.Begin()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user