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

Fix opening a readonly filetype with WOPI #2073

Merged
merged 4 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-wopi-readonly-filetype.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Fix opening a readonly filetype with WOPI

This change fixes the opening of filetypes that
are only supported to be viewed and not to be edited
by some WOPI compliant office suites.

https://github.com/cs3org/reva/pull/2073
25 changes: 19 additions & 6 deletions pkg/app/provider/wopi/wopi.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,29 @@ func (p *wopiProvider) GetAppURL(ctx context.Context, resource *provider.Resourc
}

q.Add("appname", p.conf.AppName)
q.Add("appurl", p.appURLs["edit"][ext])

if p.conf.AppIntURL != "" {
q.Add("appinturl", p.conf.AppIntURL)
var viewAppURL string
if viewAppURLs, ok := p.appURLs["view"]; ok {
if viewAppURL, ok = viewAppURLs[ext]; ok {
q.Add("appviewurl", viewAppURL)
}
}
if viewExts, ok := p.appURLs["view"]; ok {
if url, ok := viewExts[ext]; ok {
q.Add("appviewurl", url)
if editAppURLs, ok := p.appURLs["edit"]; !ok {
ishank011 marked this conversation as resolved.
Show resolved Hide resolved
if editAppURL, ok := editAppURLs[ext]; ok {
ishank011 marked this conversation as resolved.
Show resolved Hide resolved
q.Add("appurl", editAppURL)
}
} else {
// assuming that an view action is always available in the /hosting/discovery manifest
// eg. Collabora does support viewing jpgs but no editing
// eg. OnlyOffice does support viewing pdfs but no editing
// there is no known case of supporting edit only without view
glpatcern marked this conversation as resolved.
Show resolved Hide resolved
q.Add("appurl", viewAppURL)
}

if p.conf.AppIntURL != "" {
q.Add("appinturl", p.conf.AppIntURL)
}

httpReq.URL.RawQuery = q.Encode()

if p.conf.AppAPIKey != "" {
Expand Down