Allowed file extensions Widget Input/Display Length Problem

Created on 1 August 2012, over 12 years ago
Updated 17 September 2024, 2 months ago

Problem/Motivation

There is an input/display interaction problem with the File widget edit form's "Allowed file extensions" input field.

Current Operation

  • The "Allowed file extensions" field allows extensions to be separated by either a space or a comma. e.g. "txt doc rtf"
  • When it displays the extensions, they are separated by both a space and a comma. e.g. "txt, doc, rtf"
  • The field has a length restriction of 128.

It is possible to enter field data which can be saved once, but not can be saved if the field is edited at a later time.

Work Around
Edit the field content to remove commas or spaces.

Steps to reproduce

  • If you enter a list of 30 extensions, each 3 characters long separated by a space, the line length is 119 characters (30x4-1) and will be saved.
  • When the field is displayed on the next edit the field value now has an extra character per extension. The space has been transformed into a space plus comma. The length is now 148 characters (30x5-2) and can not be saved.
  • Error message: Allowed file extensions cannot be longer than 128 characters but is currently 148 characters long

Proposed resolution

TBD

  • Display the extensions separated by only a space
  • Make the length checking sophisticated enough to take the input and display differences into account

Remaining tasks

Remove #maxlength per #69

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
File module 

Last updated about 7 hours ago

Created by

🇨🇦Canada dale42 Vancouver, Canada

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @quietone opened merge request.
  • Status changed to Needs review 3 months ago
  • 🇳🇿New Zealand quietone

    Converted to an MR and made a change for #59.

  • 🇦🇺Australia acbramley

    This looks fine, but do we really need a test for this? Surely the maxlength property is tested elsewhere?

  • 🇦🇺Australia acbramley

    I think we should also revisit removing the maxlength as per #38 and fixing the tests that failed because of it (as reported in #43)

  • 🇮🇳India prashant.c Dharamshala

    The maxlength property is working properly.
    But one behavior in which if I specify the extension list comma separated such as txt,doc,docx,pdf,ppt it auto-replacing the commas with spaces which is not a good developer experience.

    In addition to this if ae are replacing the commas with spaces then we need to change the description as well from
    Separate extensions <strong>with a comma or space</strong>. Each extension can contain alphanumeric characters, '.', and '_', and should start and end with an alphanumeric character.
    to
    Separate extensions <strong>with a space</strong>. Each extension can contain alphanumeric characters, '.', and '_', and should start and end with an alphanumeric character.

  • 🇮🇳India prashant.c Dharamshala
  • 🇦🇺Australia acbramley

    Re #65 that happens currently (as in without the patch) and is intended functionality.

  • 🇺🇸United States smustgrave

    @acbramley think it's worth getting this fixed and a follow up to look into deprecating #maxlength?

  • 🇦🇺Australia acbramley

    @smustgrave - no it's not about deprecating it, just removing the property entirely from this element, it's unnecessary afaict

  • Status changed to Needs work 2 months ago
  • 🇺🇸United States smustgrave

    Updated the issue summary to use the standard template.

    Added remaining task to remove #maxlength

    Also solution should portion should be flushed out

Production build 0.71.5 2024