Skip to content

If a File is uploaded with a name containing spaces it disapears. #446

Open
@Aku-benj

Description

@Aku-benj

Description

The upload of a file containg spaces in his name is not added to the Gform entry at the end of the submit process.
I can see the file in the upload/gravity_forms1-xxx/tmp but then the gravity-form code fails to move it to the entry.

Steps to reproduce

1 - Create a form with an upload file field with option Enable Multi-File Upload active
2 - Create a local file with one or multiple spaces in the name
3 - Use the submitGfForm mutation to send the file
4 - The file is not associated to the entry at the end.

Additional context

I think the issue comes from the initialize_files function in the EntryObjectMutation class.
If we compare the creation of the $target_file to the one gravityForm uses it is missing the use of sanitize_file_name :

wp-graphql-gravity-forms: wp_basename( $temp_filename )

vs

set_uploaded_files function in GFFormsModel class.

gravity-forms: sanitize_file_name( wp_basename( $upload['temp_filename'] ) )

This leads to the call of file_exists returning a missing file.

Plugin Version

0.13.0.1

Gravity Forms Version

2.8.15

WordPress Version

6.4.3

WPGraphQL Version

1.28.0

Additional enviornmental details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for Gravity Forms, WPGraphQL, and WPGraphQL for Gravity Forms

  • Yes
  • My issue is with a specific 3rd-party plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions