Summary
After upgrading to Gravity Forms 2.10, File Upload field values are no longer rewritten to GCS URLs and the files are not synced. Entry meta keeps the local wp-content/uploads/gravity_forms/... URL and the "view file" link on the Entries screen returns 404 when the upload directory is offloaded.
Affected versions
- wp-stateless-gravity-forms-addon: 0.0.3
- Gravity Forms: 2.10.x (confirmed on 2.10.0.1 and later)
- WP-Stateless: any (the sync hook is just never reached)
Root cause
Per the GF 2.10.0.1 changelog, the File Upload field's storageType was standardized so that single-file fields are now stored as a JSON-encoded array with one element, matching multi-file fields. PHP's default json_encode escapes forward slashes, so the stored value looks like:
["https:\/\/example.com\/wp-content\/uploads\/gravity_forms\/130-hash\/2026\/06\/file.docx"]
In class-gravity-forms.php, gform_save_field_value() only calls json_decode() when $field->multipleFiles is true (lines 86-90). For a single-file field the raw JSON string is wrapped via array($value) and the loop checks strpos($v, 'gravity_forms/') — but with escaped slashes the substring is gravity_forms\/, so the check returns false, the sync action is never fired, and the URL is never rewritten.
Reproduction
- Activate Gravity Forms 2.10+ and WP-Stateless with this addon (0.0.3).
- Create a form with a single (non-multi) File Upload field.
- Submit the form with a file attached.
- Inspect
wp_gf_entry_meta for the new entry. The value is a JSON-encoded local URL; no upload to GCS occurred.
Expected
The file is uploaded to GCS and the stored meta value contains the storage.googleapis.com/<bucket>/gravity_forms/... URL.
Suggested direction
Detect the value's shape from its content (json_decode returns an array) rather than from $field->multipleFiles, normalize to an array, run the existing sync loop, and re-encode in the original shape so behavior on older GF releases (single-file = raw string) is unchanged.
While in this method, modify_db() has a related issue at the JSON branch where the re-encoded value is taken from the original unmodified variable rather than the rewritten result — happy to include that fix in the same PR.
A PR is on the way.
Summary
After upgrading to Gravity Forms 2.10, File Upload field values are no longer rewritten to GCS URLs and the files are not synced. Entry meta keeps the local
wp-content/uploads/gravity_forms/...URL and the "view file" link on the Entries screen returns 404 when the upload directory is offloaded.Affected versions
Root cause
Per the GF 2.10.0.1 changelog, the File Upload field's
storageTypewas standardized so that single-file fields are now stored as a JSON-encoded array with one element, matching multi-file fields. PHP's defaultjson_encodeescapes forward slashes, so the stored value looks like:In
class-gravity-forms.php,gform_save_field_value()only callsjson_decode()when$field->multipleFilesis true (lines 86-90). For a single-file field the raw JSON string is wrapped viaarray($value)and the loop checksstrpos($v, 'gravity_forms/')— but with escaped slashes the substring isgravity_forms\/, so the check returnsfalse, the sync action is never fired, and the URL is never rewritten.Reproduction
wp_gf_entry_metafor the new entry. The value is a JSON-encoded local URL; no upload to GCS occurred.Expected
The file is uploaded to GCS and the stored meta value contains the
storage.googleapis.com/<bucket>/gravity_forms/...URL.Suggested direction
Detect the value's shape from its content (
json_decodereturns an array) rather than from$field->multipleFiles, normalize to an array, run the existing sync loop, and re-encode in the original shape so behavior on older GF releases (single-file = raw string) is unchanged.While in this method,
modify_db()has a related issue at the JSON branch where the re-encoded value is taken from the original unmodified variable rather than the rewritten result — happy to include that fix in the same PR.A PR is on the way.