Skip to content

WOPI App Name is admin configurable, but we hardcoded it #10306

Closed

Description

@butonic

The collaboration service uses the hardcoded strings collabora and onlyoffice to identify the kind of CS3 app provider.

For the app url:

if strings.ToLower(s.config.App.Name) == "collabora" {
// collabora provides only one action per extension. usual options
// are "view" (checked above), "edit" or "view_comment" (this last one
// is exclusive of collabora)

For the language:

switch strings.ToLower(s.config.App.Name) {
case "collabora":
q.Add("lang", lang)
case "onlyoffice":
q.Add("ui", lang)

The type determines the properties returned in the GetFileInfo call:

switch strings.ToLower(f.cfg.App.Name) {
case "collabora":
info = &fileinfo.Collabora{}
case "onlyoffice":
info = &fileinfo.OnlyOffice{}
default:
info = &fileinfo.Microsoft{}
}

We noticed this when reviewing cs3org/reva#4882 (review)

All of these checks will break when the app name has been changed to eg: WebOffice.

The app Name really is a display name that is used by clients. We should introduce a product property on the cs3 api that we can use to handle product specific differences.

Activity

  1. added
    Priority:p2-high
    on Oct 15, 2024
  2. moved this from Qualification to Prio 2 in Infinite Scale Team Boardon Oct 15, 2024
  3. butonic commented on Oct 15, 2024

    @butonic
    ContributorAuthor
  4. jvillafanez commented on Oct 17, 2024

    @jvillafanez
    Member

    #10335 should do for the most part. We still need to send the provider to reva in order to use the templates.
    The easiest option might be to send it during app registration (https://github.com/owncloud/ocis/blob/master/services/collaboration/pkg/helpers/registration.go#L64C26-L71), but we'd need to change the cs3apis.

    Since the names can change, we'll need to take care of weird chars. Right now, it seems that there is a problem if the App.Name contains a space (web shows the name with the space correctly):

    ocis-1           | {"level":"error","service":"gateway","pkg":"rgrpc","traceid":"9d09077404f9a5d7b9439dfa75eea898","user-agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0","from":"tcp://172.20.0.6:46954","uri":"/cs3.gateway.v1beta1.GatewayAPI/OpenInApp","start":"17/Oct/2024:09:03:32 +0000","end":"17/Oct/2024:09:03:32 +0000","time_ns":3028322,"code":"Unknown","time":"2024-10-17T09:03:32Z","message":"gateway: error calling findAppProvider: error: not found: app 'Colla%20Bora' not found"}
    ocis-1           | {"level":"error","service":"frontend","pkg":"rhttp","traceid":"89ad0050261880f7a41e38115f9390c9","request-id":"ba3dcabb-95c4-46e1-943d-8a7194f64531","error":"rpc error: code = Unknown desc = gateway: error calling findAppProvider: error: not found: app 'Colla%20Bora' not found","time":"2024-10-17T09:03:32Z","message":"Error contacting the requested application, please use a different one or try again later"}
    ocis-1           | {"level":"error","service":"frontend","pkg":"rhttp","traceid":"89ad0050261880f7a41e38115f9390c9","host":"127.0.0.1","method":"POST","uri":"/app/open?file_id=79788a3d-c825-4287-983e-da76f535b8a8%24744811fc-08de-468a-9caf-b25a792faa28%219f5ba531-b6ba-4aa5-93a8-64431614fce5&lang=en&app_name=Colla%2520Bora&view_mode=write","url":"/open?file_id=79788a3d-c825-4287-983e-da76f535b8a8%24744811fc-08de-468a-9caf-b25a792faa28%219f5ba531-b6ba-4aa5-93a8-64431614fce5&lang=en&app_name=Colla%2520Bora&view_mode=write","proto":"HTTP/1.1","status":500,"size":134,"start":"17/Oct/2024:09:03:32 +0000","end":"17/Oct/2024:09:03:32 +0000","time_ns":17015094,"time":"2024-10-17T09:03:32Z","message":"http"}
    

    There could also be problems with the service names (https://github.com/owncloud/ocis/blob/master/services/collaboration/pkg/helpers/registration.go#L69 among others) if the name contains "." or weird chars. We should decide what to do with those.

    Finally, this seems a breaking change for Microsoft and OnlyOffice installations (we're using Collabora as default, so they're lucky they won't be hit). If you're using OnlyOffice as app name, Collabora will be used as provider name (assuming you haven't changed it yet), so some features are expected to break. Adding the env variable and restarting the system should be enough to fix the problem though.

  5. micbar commented on Oct 25, 2024

    @micbar
    Contributor

    Next step: Start PR on the CS3API to add the ProductName Property on the app.

  6. self-assigned this
    on Oct 31, 2024
  7. 2403905 commented on Oct 31, 2024

    @2403905
    Contributor
  8. 2403905 commented on Nov 4, 2024

    @2403905
    Contributor

    I prepared the cs3api bump for reva cs3org/reva#4906
    I don't see any braking changes cs3api.

  9. 2403905 commented on Nov 4, 2024

    @2403905
    Contributor
  10. micbar commented on Nov 5, 2024

    @micbar
    Contributor

    PR has been merged #10335

  11. wkloucek commented on Nov 7, 2024

    @wkloucek
    Contributor
  12. micbar commented on Nov 7, 2024

    @micbar
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Priority:p2-highType:Bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions