Text-service output can use custom paths#628
Open
donaldgray wants to merge 8 commits into
Open
Conversation
Previous code used DefaultFormats, rather than Defaults, meaning that the default values couldn't be overridden by standard appSettings.
Small change, keeps call sites cleaner by not needing to always call .ToString() when passing what is always an int.
Allows customisation of generated paths. Source values from existing configuration, adding "TextServiceJob" to list of known path formats
Defaults shared a reference with the static DefaultFormats, so binding config values leaked into the baseline defaults. Copy the baseline per instance instead. There's currently no issue with this but fixing as I noticed, it could bite in the future
PathTemplate is a simple type that maps a path template, it's more descriptive than string and allows cleaner callsite for generating paths. PresentationPathReplacementHelpers and known consts from SupportedTemplateOptions were folded into single type. No functional changes.
These paths are output only, we don't want to attempt to parse them from incoming resources. This may change in the future but for now remove these templates from parsing logic.
f5665b3 to
17af695
Compare
JackLewis-digirati
approved these changes
Jul 3, 2026
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.
What does this change?
Resolves #619 - allows control of how text-service paths, in line with https://github.com/dlcs/text-services/blob/main/instructions/alternative-paths.md
X-Forwarded-HostandX-Forwarded-Pathare always set when making request. Former is set to Orchestrator URL, latter is set to default value, optionally overridden byTextServiceJobpath template.Additional Changes
Introduced new
PathTemplatetype, in favour ofstringfor templates. Expresses expectations better and allowedPresentationPathReplacementHelpersandSupportedTemplateOptionsto be stored in single place.Added benefit is that call sites are now much cleaner:
Made 2 small tweaks in
TypedPathTemplateOptions-DefaultFormatsasDefaults, create a copy instead. Currently changing the overridden values (set via appSettings) would override the baked-in presets.GetPathTemplatesForHost()usesDefaultsrather thanDefaultFormatsto get all templates. PreviouslyGetPathTemplatesForHost()would always used theDefaultFormatsvalue, rather thanDefaults. This is only used inPathRewriteParserConfiguration Changes
Optional
TextServiceJobpath template value. Seepath-customisation.mdadded with this PR for more details.