Repository navigation
fix(server): resolve section-style step image names (Recipe.S.N.ext) - #388
Merged
Merged
Conversation
Step images were only looked up as Recipe.N.ext with N counting steps continuously across sections, so images named with the section convention used by the iOS app (Recipe.S.N.ext) never appeared. cooklang-find already indexes both conventions; try the section-specific name first and fall back to the continuous one, so recipe collections written for either app render step images in both. Fixes #374
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the step-image naming discrepancy between the CLI server and the iOS app (#374).
cooklang-find'sStepImageCollectionalready indexes both conventions —Recipe.N.ext(step N counted continuously across sections) at section bucket 0, andRecipe.S.N.ext(section S, step N within it, as used by the iOS app) at bucket S-1. But the web builder only ever queriedget(0, continuous_step), so section-style names never resolved.The builder now tries the section-specific lookup first and falls back to the continuous one:
Both conventions now work in
cook serverandcook build web(they share this builder), and the section-specific image wins when both exist for the same step. Backward compatible — existing linear-named collections resolve exactly as before (for section 1 the two lookups are identical, since cooklang-find stores section 1 and linear names in the same bucket).Fixes #374
Testing
New integration test
tests/step_images_test.rscovering a two-section recipe (written first, confirmed red):Linear.1.jpg/Linear.2.jpgresolve across sections (passed before the fix)Sectioned.1.1.jpg/Sectioned.2.1.jpgresolve per section (failed before, passes now)cargo fmt,cargo clippy, and the fullcargo testsuite pass cleanly.