Fix: Trim URLSegment before applying replacements in filter