Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support: Mime types and CoolUtils::canEdit() #77

Open
donquixote opened this issue Dec 12, 2024 · 2 comments
Open

Support: Mime types and CoolUtils::canEdit() #77

donquixote opened this issue Dec 12, 2024 · 2 comments

Comments

@donquixote
Copy link
Collaborator

@hfiguiere

There is a function CoolUtils::canEdit() which determines if a specific mime type is supported for edit mode in the Collabora editor.
This uses a hard-coded list of read-only mime types.

  const READ_ONLY = [
    'application/x-iwork-keynote-sffkey' => TRUE,
    'application/x-iwork-pages-sffpages' => TRUE,
    'application/x-iwork-numbers-sffnumbers' => TRUE,
  ];

I wonder if this is how it has to be, OR if the same information should be extracted from the discovery.xml.

@hfiguiere
Copy link
Collaborator

This information could be extracted from the discovery, but the only place it is called we don't have the discovery.xml. Requesting it as this time would introduce a lag, short of caching it.

Given that this list is the intersection of the set of file types that Drupal recognize as office files and the one we support only as import in COOL, and that it may no change often, this looked like the simplest solution to not offer to edit files Collabora Online doesn't know how to edit.

@donquixote
Copy link
Collaborator Author

This information could be extracted from the discovery, but the only place it is called we don't have the discovery.xml. Requesting it as this time would introduce a lag, short of caching it.

Good point.
It happens when we build urls.
Actually we do consider caching the discovery.xml, but have not done it yet. I want to do it in a dedicated PR, because we need to be careful when that cache needs to be cleared / invalidated.
At that point it's a question whether we would be ok with a possible lag on a cold cache first time visit.

Given that this list is the intersection of the set of file types that Drupal recognize as office files and the one we support only as import in COOL, and that it may no change often, this looked like the simplest solution to not offer to edit files Collabora Online doesn't know how to edit.

Alright, going to keep the behavior as is for now.
I wanted to convert this into a service but then it seemed so one-off and arbitrary that I could not think of a good name.
But we can come up with something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants