From 9ba6c0ca634fe1eaaa28b00310f5574c48a0a4b5 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Wed, 7 Oct 2026 20:01:46 -0700 Subject: [PATCH] fix: review flow uses the served image url and the lora-dirs test pins its config Image paths in API responses are now relative to the ComfyUI tree, so the auto-tag review page can no longer derive a serve URL from image_path; the server always provides url. The lora-dirs serving test assumed an empty LoraManager path, which only held in a checkout without a local config.json. --- tests/test_api_images.py | 4 ++++ web/js/admin.js | 10 +++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_api_images.py b/tests/test_api_images.py index 0798a63..c6c6d4b 100644 --- a/tests/test_api_images.py +++ b/tests/test_api_images.py @@ -986,8 +986,11 @@ class TestServeErrorBranches(ImageRouteCoverageCase): ): png = make_png(Path(lora) / "preview.png") image_id = self._link_image(png) + # An empty configured path means auto-detection; a developer's + # own config.json may hold a real LoraManager path, so pin it. with ( patch.object(IntegrationConfig, "LORA_MANAGER_ENABLED", True), + patch.object(IntegrationConfig, "LORA_MANAGER_PATH", ""), patch("py.lora_utils.find_lora_directories", return_value=[lora]), patch("py.lora_utils.get_lora_image_cache_dir", return_value=cache), ): @@ -998,6 +1001,7 @@ class TestServeErrorBranches(ImageRouteCoverageCase): with ( patch.object(IntegrationConfig, "LORA_MANAGER_ENABLED", True), + patch.object(IntegrationConfig, "LORA_MANAGER_PATH", ""), patch("py.lora_utils.find_lora_directories", side_effect=RuntimeError), ): resp = await self.client.request( diff --git a/web/js/admin.js b/web/js/admin.js index bd36ae3..708161d 100644 --- a/web/js/admin.js +++ b/web/js/admin.js @@ -3630,13 +3630,9 @@ Seed: ${this.currentMetadata.seed || 'Unknown'}`; const image = this.autoTagState.reviewImages[this.autoTagState.reviewIndex]; document.getElementById('reviewCurrentIndex').textContent = this.autoTagState.reviewIndex + 1; - // Build image URL from image_path (database field) - const imagePath = image.image_path; - const filename = imagePath.split('/').pop(); - // Use the serve endpoint with relative path - const relPath = imagePath.includes('/output/') ? - imagePath.substring(imagePath.indexOf('/output/') + 8) : filename; - const imageUrl = `/prompt_manager/images/serve/${relPath}`; + // The API describes images relative to the ComfyUI tree and + // always provides a servable url; never rebuild it from the path. + const imageUrl = this.getImageUrl(image); // Check if image already has real tags (excluding auto-scanned) const realTags = this.getRealTags(image.prompt_tags);