pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.71k stars 824 forks source link

Question about QRCode / barcode formatting #662

Closed mikezimm closed 1 year ago

mikezimm commented 1 year ago

In the past, I created some formatting which uses free online bar code generators similar to this example:

https://github.com/pnp/List-Formatting/tree/c917a1d6dc732d5248b3bae43212640e05929a7e/column-samples/text-qrcode

We have been using this type of formatting for a couple years now without issue. Actual formatting is shown below.

Today it suddenly stopped working while in a read-only view. If you go into Quick Edit mode the bar code would be visible.

We ended up fixing it by going to the site collection settings, then adding the domain to HTML Field Security (screenshot below). I am just wondering what might have changed that would have caused it to break? No one on the site changed any setting so I'm guessing a tenant level setting impacted it.

And also, why if it is flagged as a security setting, would it be ok for it to work in Quick Edit but not in read only.

Thanks for any input!

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "img",
  "style": {
    "width": "150px",
    "overflow": "hidden",
    "padding": "20px",
  },
  "attributes": {
    "src": "='https://bwipjs-api.metafloor.com/?bcid=datamatrix&text=' + @currentField + '&scale=2'"
  }
}

image

tecchan1107 commented 1 year ago

Thanks for submitting the issue! I have confirmed it on my end. I will add instructions for adding it to HTML Field Security in the README.

I checked this document and the following text was recently added😣 This update may have been applied and the images are no longer displayed.... image

mikezimm commented 1 year ago

@tecchan1107 , Thanks for figuring it out! I get security concerns and am just glad it is documented somewhere.

Does anyone know of a way to add a domain on the tenant level? In our case, we created a similar service on our own servers for security reasons and would like to just apply that setting in a single location instead of dozens of places we have no clue are broken.

Thanks again, very much appreciated!

tecchan1107 commented 1 year ago

As far as I know, it cannot be set at the tenant level, it would be per site. And I think the easiest way to apply it to all sites is to use PowerShell. The following sites may be helpful.