richdocuments icon indicating copy to clipboard operation
richdocuments copied to clipboard

Custom fonts issue

Open vladimirdulov opened this issue 1 year ago • 2 comments

Collabora Online doesn't load custom fonts uploaded on Nextcloud using remote_font_config.

I've found out that /apps/richdocuments/settings/fonts.json contains escaped slashes in fonts urls and for some reason Collabora doesn't load them. If JSON_UNESCAPED_SLASHES added to json_encode() in JSONResponse::render() it starts to work properly.

Not sure if it's a beauty workaround but it works if a new class JSONFontResponse implemented like:

class JSONFontsResponse extends JSONResponse {
        public function render() {
                return json_encode($this->data, JSON_HEX_TAG | JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
        }
}

then SettingsController::getJsonFontList() gets amended in https://github.com/nextcloud/richdocuments/blob/main/lib/Controller/SettingsController.php#L309

--  $response = new JSONResponse($fontList);
++ $response = new JSONFontsResponse($fontList);

vladimirdulov avatar May 31 '24 06:05 vladimirdulov

Will need to check, maybe there was an upstream change in online that caused this? @pedropintosilva Do you have any insight there?

juliusknorr avatar Jun 07 '24 06:06 juliusknorr

What version(s)? You skipped our bug report template. :)

I don't see escaping in my test instance (which was a little surprising, honestly).

joshtrichards avatar Jun 21 '24 14:06 joshtrichards

Closing as there is no feedback.

@vladimirdulov Please don't hesitate to reopen once provided the additional insights

juliusknorr avatar Jul 31 '24 16:07 juliusknorr