assets: ensure forced-standalone handles new-and-matches images #1066
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.
When forcing assets in standalone (e.g. images that are dynamically generated after the pre-processing stage), it will assume a found asset entry is an indication that the asset was generated by another dynamic image on the same document. However, this not guaranteed to be the case. For example, "page a" may generate a standalone image and register it into the asset manager. A few moments later, "page b" may generate its own standalone image instance that results in the same physical file, but the asset message indicates its origin is "page a". With the original implementation, this would generate an assert.
Since the assert is wrong in this case, instead of asserting the document name maps in the asset name, if it does not map, do not consider the cached asset as the asset to use. Instead, we clear the key which allows a translator to rework the asset reference. This in turn should register a reference of this new document in the asset.