cog
635fffb8 - fix: don't coerce URL strings in str-typed inputs (regression #2868) (#2872)

Commit
100 days ago
fix: don't coerce URL strings in str-typed inputs (regression #2868) (#2872) * test: add integration tests reproducing URL string coercion regression (#2868) str-typed inputs that contain URLs (e.g. API endpoints) are incorrectly coerced into cog.Path/File objects by coerce_url_strings() in coglet. These tests assert that str and list[str] inputs preserve URL strings as-is. Both tests are expected to FAIL on the current codebase. * fix: only coerce URL strings for File/Path-typed inputs, not str (#2868) coerce_url_strings() was iterating over all input fields and coercing any URL-like string via Path.validate(), even for fields declared as plain str. This meant API endpoint URLs passed as string inputs were incorrectly converted into cog.Path objects. Refactor detect_file_fields() into classify_fields() which returns a FieldClassification with separate sets for File-typed and Path-typed fields. coerce_url_strings() now skips any field not in either set, leaving str and other non-file types untouched. --------- Co-authored-by: Michael Dwan <code@michaeldwan.com>
Author
Parents
Loading