Skip to content

Commit

Permalink
Merge pull request #138 from biigle/remove-svgs
Browse files Browse the repository at this point in the history
Enable SVG removal
  • Loading branch information
mzur authored Feb 2, 2024
2 parents c6f5431 + 0461563 commit a980bc9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Jobs/RemoveImageAnnotationPatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ protected function deletePatches()
foreach ($this->annotationIds as $id => $uuid) {
$prefix = fragment_uuid_path($uuid);
$disk->delete("{$prefix}/{$id}.{$format}");
$disk->delete("{$prefix}/{$id}.svg");
}
}
}
1 change: 1 addition & 0 deletions src/Jobs/RemoveVideoAnnotationPatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ protected function deletePatches()
foreach ($this->annotationIds as $id => $uuid) {
$prefix = fragment_uuid_path($uuid);
$disk->delete("{$prefix}/v-{$id}.{$format}");
$disk->delete("{$prefix}/v-{$id}.svg");
}
}
}
3 changes: 3 additions & 0 deletions tests/Jobs/RemoveImageAnnotationPatchesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ public function testHandle()
$annotation = ImageAnnotationTest::create();
$prefix = fragment_uuid_path($annotation->image->uuid);
$path = "{$prefix}/{$annotation->id}.jpg";
$pathSvg = "{$prefix}/{$annotation->id}.svg";
Storage::disk('test')->put($path, 'test');
Storage::disk('test')->put($pathSvg, 'test');

$args = [$annotation->id => $annotation->image->uuid];
(new RemoveImageAnnotationPatches($args))->handle();
$this->assertFalse(Storage::disk('test')->exists($path));
$this->assertFalse(Storage::disk('test')->exists($pathSvg));
}

public function testHandleChunk()
Expand Down
3 changes: 3 additions & 0 deletions tests/Jobs/RemoveVideoAnnotationPatchesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ public function testHandle()
$annotation = VideoAnnotationTest::create();
$prefix = fragment_uuid_path($annotation->video->uuid);
$path1 = "{$prefix}/v-{$annotation->id}.jpg";
$path2 = "{$prefix}/v-{$annotation->id}.svg";
Storage::disk('test')->put($path1, 'test');
Storage::disk('test')->put($path2, 'test');

$args = [$annotation->id => $annotation->video->uuid];
(new RemoveVideoAnnotationPatches($args))->handle();
$this->assertFalse(Storage::disk('test')->exists($path1));
$this->assertFalse(Storage::disk('test')->exists($path2));
}

public function testHandleChunk()
Expand Down

0 comments on commit a980bc9

Please sign in to comment.