getgrav / grav-plugin-form

Grav Form Plugin
http://getgrav.org
MIT License
53 stars 79 forks source link

upload json files not working - not being emailed or saved into specified location #292

Open JohnMica opened 5 years ago

JohnMica commented 5 years ago

Hi guys,

i believe there is an issue with the latest beta release

forms:
  custom_form:
    fields:
      - name: name
        type: text
        label: "Your name"
        validate:
          required: true
      - name: email
        label: "Your email"
        type: email
        validate:
          required: true
      - name: upload-file
        label: "Add a file"
        type: file
        multiple: false
        limit: 1
        destination: user/data/files
        accept:
          - application/json
          - application/yaml
          - application/yml
          - .json
          - image/*
          - .yaml
          - .yml
    buttons:
      - type: submit
        value: Submit
    process:
      - email:
          body: '{% include "forms/data.html.twig" %}'
          attachments:
            - upload-file
      - display: /join-us/thankyou

tried to upload and email a json files but the email send and received gets no attachment (even though there is a success), user/files has no idea of this type of file.

using any image type will have the desired results - email with attached image, user/files contains he image

JohnMica commented 5 years ago

the frontend validation is successful in checking the file type but

seems there is a silent fail for the json files somehow being set.

{"status":"error","message":"Unable to upload file X-Road.json: Bad filename"}
rhukster commented 5 years ago

This is probably related to the new security checks. Look in config -> security and then remove JSON from the list of dangerous extensions.

JohnMica commented 5 years ago

Hi Andy,

No json extension in there. Only the default ones - php, html, htm, js, exe.

Regards,

John Mica

On 15 Nov 2018, at 13:53, Andy Miller notifications@github.com wrote:

This is probably related to the new security checks. Look in config -> security and then remove Jason from the list of dangerous extensions.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

michaelschoenbaechler commented 5 years ago

There is still an issue with uploading files since the major release. After processing without an error the file is not in the proper location (destination). But the file, which was uploaded in "tmp/forms" before processing is deleted.

However, this is not happening when working with version 2.x

title: Upload
visible: false
form:
    name: upload-form
    fields:
        -
            name: event
            type: select
            data-options@: 'Grav\Theme\Custom::getEvents'
            default: ''
            validate:
                required: true
            options:
                '': 'Event wählen'
        -
            name: photos
            type: file
            label: 'Fotos hierher ziehen'
            destination: 'user/data'
            multiple: true
            accept:
                - 'image/*'
    buttons:
        -
            type: submit
            value: Hochladen
    process:
        -
            reset: true