0

We are integrating CKFinder with the CKEditor installation in PeopleSoft. We created our own connector in Peoplesoft and almost everything is now working except editing image. It is stuck in the loading image dialog. We already implemented ImageInfo and the response is successfully received. In my observation, the following are the requests made by the browser.

  1. caman.js [GET]
  2. ImageInfo Command Request [GET]
  3. (current URL)?camanproxyURL=(CKFinder Thumbnail Request URL) [GET]
  4. (current URL)?camanproxyURL=(CKFinder ImagePreview Request URL) [GET]

I tried this in CKFinder demo but I don't see # 3 and #4 and the Thumbnail and ImagePreview were directly requested. I think the problem here is in #3 and #4, the URL used is the current URL which is .../ckeditor/ckfinder/ckfinder.html. I don;t this is what supposed to happen.

How do I fix this issue? Is this something with our setup or configuration? CKFinder is inside our CKEditor directory.

user1173805
  • 79
  • 1
  • 3
  • 12

1 Answers1

0

We're using custom CamanJS with some improvements. One of them was this change. It was due to similar problem with domain name that contain - in it's name. The fix changed a regexp that was used to tell if domain is local or remote (if a domain URL fails this regexp the proxy mechanism is used).

Could you verify that a domain URL that you are using for development passes this regex:

/(?:(?:http|https):\/\/)((?:[\w-]+)\.(?:(?:-|\w|\.)+))/
jodator
  • 2,445
  • 16
  • 29
  • The regex used in our caman.js is `/(?:(?:http|https):\/\/)((?:[-|\w]+)\.(?:(?:-|\w|\.)+))/`. It's a bit different than what you provided. I tried validating in [regex101](https://regex101.com/) and our URL passes both. But I think the problem is it matches document.domain which doesn't have http/https and thus fails with the regex. – user1173805 Jun 13 '17 at 07:47
  • By the way, we do have `-` in our domain. – user1173805 Jun 13 '17 at 08:55
  • I found the issue. I'm dealing with subdomains. For example: document.domain is `domain.com` (I set this in CKFinder's config.js to solve cross-site scripting issues) The match of the regex is `sub.domain.com` so it doesn't match. I guess I will have to change the regex or compare it with `window.location.hostname` instead of document.domain. I'm not sure though if that's okay. – user1173805 Jun 13 '17 at 12:00
  • The caman.js is embedded in ckfinder.js file so it should have fixed regex for '-' in domain name. (I'm not sure how do you replace that). As for regex the image src should pass it not the domain - sorry for wrong description. So the request for an image that CKFinder issues, like `'http://sub.domain.com/ckfinder/core/connector/php/connector.php?command=ImagePreview&otherparams=1'.match( /thatregex/ )` should match above regex and the matched value should be identical with `document.domain`. The fix for domain name was provided in CKFinder 3.1. – jodator Jun 15 '17 at 05:33