Closed (fixed)
Project:
Colorbox
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2022 at 11:19 UTC
Updated:
25 Sep 2024 at 18:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
damienmckennaComment #3
damienmckennaThis changes the paths in hook_libraries() so that they match what the library provides.
Comment #5
camuschino_x commentedIt works for me. Thanks
Comment #6
kevin morse commentedAlso worked for me.
Comment #7
pixiekatIf you're installing from composer or asset-packagist, you'll need to change the directory name from "dompurify" to "DOMPurify", too.
Comment #8
terminator727 commentedhow i can install the DOMPurify librarie with composer?
Comment #9
pixiekatAdd this to your repositories object, changing dist and version to whatever the current version that you want is:
Then run
composer require cure53/dompurifyComment #10
krzysztof domański#3 LGTM
Comment #11
bcobin commentedI have the same issue in Drupal 9, but the code here doesn't seem to correspond. And I don't see the same issue tagged for Drupal 9. The library is installed in /libraries/DOMPurify/dist/purify.min.js, as per instructions.
Any ideas? Thanks in advance...
Comment #12
softpol commentedSame problem here (Drupal-9.4.8): colorbox doesn't see the DOMPurify library.
ls -l libraries/DOMPurify/dist
total 696
-rw-r--r-- 1 61671 Oct 10 13:07 purify.cjs.js
-rw-r--r-- 1 119310 Oct 10 13:07 purify.cjs.js.map
-rw-r--r-- 1 61660 Oct 10 13:07 purify.es.js
-rw-r--r-- 1 119307 Oct 10 13:07 purify.es.js.map
-rw-r--r-- 1 64590 Oct 10 13:07 purify.js
-rw-r--r-- 1 119314 Oct 10 13:07 purify.js.map
-rw-r--r-- 1 21689 Oct 10 13:07 purify.min.js
-rw-r--r-- 1 88946 Oct 10 13:07 purify.min.js.map
ls -l libraries/DOMPurify/
total 4
drwxr-xr-x 2 4096 Oct 10 13:07 dist
ls -l libraries
total 80
drwxr-xr-x 3 4096 Oct 10 13:07 DOMPurify
(…)
Comment #13
bcobin commentedIf I remember correctly, installing from Drush (as noted on the project page) did it for me:
Good luck!
Comment #14
softpol commentedIndeed, this works!
But the drush command installs the library in libraries/dompurify instead of in libraries/DOMPurify.
So, the instructions on the colorbox settings page are wrong…
Comment #15
paulmckibbenFolks, since this issue was originally against the Drupal 7 version of colorbox, and since that specific issue is not yet resolved, it would be helpful to track Drupal 9 concerns in a separate issue.
I have created #3314730: DOMPurify library path - inconsistent capitalization to track the potential Drupal 9 issue with the DOMPurify library path. I will look more deeply as time allows, but anyone is welcome to offer a deeper analysis and a patch (and I would be eternally grateful).
Comment #16
damienmckennaThanks Paul.
Comment #17
clayclai commentedI was able to make the warning go away by creating a symbolic link one level up:
drupal7/sites/all/libraries/DOMPurify# ln -sf dist/purify.min.js purify.min.js
I wasn't sure if it needed and couldn't find the map file, so I added:
drupal7/sites/all/libraries/DOMPurify# ln -sf dist/purify.min.js.map purify.min.js.map
for good measure. Hope this helps.
Comment #18
bosmaen commentedSolution #17 works for D7. Good one clayclai
Comment #19
Kohaydo commentedpath "sites/all/libraries/DOMPurify/dist/purify.min.js"
change Folder name - "DOMPurify' to "dompurify"
Comment #20
aiphesIssue here on D9.5.7 and
Media Colorbox (colorbox) Enabled 2.0.0with this:
Comment #21
mj42 commentedD7.95 path that solved it for me was "/sites/all/libraries/DOMPurify/purify.min.js" (Colorbox 7.x-2.17)
Comment #22
k8e1050 commentedThanks mj42. That worked for me as well. woohoo.
Comment #23
paulmckibbenFor security reasons, you should not install the entire contents of the DOMPurify archive. You should only install purify.min.js, in sites/all/libraries/DOMPurify/purify.min.js.
Comment #24
damienmckennaPaul: then the codebase needs to be updated to streamline this. The codebase includes a segment in the Drush Make file for downloading Colorbox, it should have a similar section for downloading DOMPurify and then hook_libraries() should match where it stores the files.
Would this work?
Comment #25
paulmckibbenDamien, thanks for clarifying that the issue has to do with automatically downloading the file using drush make. That was not clear from the issue description or comment history.
I'm doing my best to support the Drupal 7 version on a best effort basis, so I may need further help. I see that we need to support a download mechanism using drush make. However, I'd also like to avoid hard-coding a version number if possible. Is there a way we can do that?
Comment #26
damienmckennaHow about pointing to the 3.x version, rather than a release version? https://github.com/cure53/DOMPurify/blob/3.x/dist/purify.min.js
I can also look at the docs to see if the wording can be improved to make it easier for people to do it correctly.
Comment #27
paulmckibben@DamienMcKenna, yes, 3.x would be fine. And I also appreciate your eyes on the documentation. Thank you.
Comment #28
damienmckennaAdding it to my list to work on.
Comment #29
damienmckennaHow about something like this?
Comment #30
damienmckennaComment #31
chowdah commentedRan into this on a Drupal 7 that I have yet to upgrade. I'll be migrating to D9 for this site very soon. What worked for this install was keeping the folder name DOMPurify, then moving the purify.min.js & purify.min.js.map from the dist folder to the root of the DOMPurify folder and deleted all the other files. #17 would have worked as well, but im trying to minimize and clean up all the crap from this site [it's a beast that's been migrated from D5 to D6 to d7] prior to upgrade.
Comment #32
dqdWell, this is also true for latest v2 release and 2.0-dev - so a re-roll would be great and some maintainers to at least merge to dev would be very appreciated ;-)
or! -> to simply change documentation on this.
Comment #33
damienmckennaBecause they use completely different methods for managing the codebases, please keep the D7 and D9+ changes separate.
Comment #34
coolwaveTC commentedPost #9 worked for me, Jan 2024. Drupal 10 site on Pantheon.
Comment #35
dqdI see! That makes sense! Thanks for clarifying @DamienMcKenna and sorry for the noise.
Interesting! Can you please create a new issue like Damien suggested before, so that a patch can be created there based on #9 for this version? Thanks for your report! +1
Comment #36
wildhostile commentedPost #14 is the key on Drupal 9.5.11. Thanks @softpol.
Comment #38
paulmckibben@DamienMcKenna, thanks for the patch, and sorry for the long wait. I have committed your patch to the 7.x-2.x branch.
Comment #39
theturtle commentedHi,
I'm working with a Drupal 7, Colorbox 2.17 en DOMPurify, everyhting was fine.
Yesterday, I updated Colorbox from 2.17 to 2.18 and since that, I have a problem with the DOMPurify's library which is not found.
I put the file at sites/all/libraries/DOMPurify/purify.min.js, with 2.17 everything is fine, with 2.18, library isn't detected.
Do you have any explanations ?
Thanks.
Comment #40
paulmckibben@theturtle Thanks for reporting this. The patch from #29 removed the version information from the library info, which caused the version check to fail. I will add that back and provide a new release shortly.
Comment #42
paulmckibbenThis is now committed, and I'll tag a new release 7.x-2.19 shortly.
Comment #43
theturtle commentedHi Paul,
This is perfect! It works perfectly with the 2.19 version.
Thanks for the quick response and all your work.
Comment #45
walmac commented#31 worked for me (Drupal 7.99).
Comment #46
ccarnnia commentedhi all,
mv libraries/DOMPurify libraries/dompurifyfixed it for me.