VizAlerts icon indicating copy to clipboard operation
VizAlerts copied to clipboard

|filename doesn't allow all characters in VIZ_LINK() content reference

Open jdrummey opened this issue 8 years ago • 1 comments

The |filename argument is used for both actual filenames as well as the optional text of the VIZ_LINK() content reference. For filenames only -_.[a-zA-Z0-9] are allowed values, so something like "Josie's Dashboard" isn't allowed because it's got a single quote.

I've got two ideas on this:

  1. use a separate argument for VIZ_LINK() for the displayed text of the URL (instead of |filename)

  2. allow |filename to support more complex characters when used in the VIZ_LINK argument.

I did an implementation of the latter, here's the code starting at line 1340 in the find_viz_refs() function:

                                # looking for |exportfilename
                                if element.startswith(EXPORTFILENAME_ARGUMENT):
                                    filename = re.match(EXPORTFILENAME_ARGUMENT + u'=(.*)', element).group(1)

#~~~added these two lines
                                    # if vizrefformat.group(1) is other than LINK then go through all validation tests
                                    if vizrefformat.group(1) != 'LINK':
#~~~end of added lines next section of code is indented for the if condition
                                         # code from https://github.com/mitsuhiko...

jdrummey avatar Apr 19 '16 14:04 jdrummey

Honestly, it kind of bugs me that "filename" is the name of the parameter for VIZ_LINK() when it doesn't really apply. I think if you see lots of value in overloading the "filename" parameter between content ref types, I'd like to switch it to just "name", because "Filename" doesn't really apply to VIZ_LINK(), but "name" could be reasonably applied to all the content ref types we support. Then we can handle validation of the value the user feeds in for that parameter differently depending on the content ref type (links allow lots of characters, pdf/csv/png allow less).

mcoles avatar Apr 22 '16 15:04 mcoles