Skip to content

Commit

Permalink
Fail initialization if app is unsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Sep 6, 2021
1 parent 73f10ed commit ac1146a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/appprovider-unsupported.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: fail initialization of a WOPI AppProvider if
the underlying app is not WOPI-compliant nor it is supported
by the WOPI bridge extensions

https://github.com/cs3org/reva/pull/2034
11 changes: 6 additions & 5 deletions pkg/app/provider/wopi/wopi.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,18 @@ func getAppURLs(c *config) (map[string]map[string]string, error) {

// scrape app's home page to find the appname
if !strings.Contains(buf.String(), c.AppName) {
// || (c.AppName != "CodiMD" && c.AppName != "Etherpad") {
return nil, errors.New("Application server at " + c.AppURL + " does not match this AppProvider for " + c.AppName)
}

// register the supported mimetypes in the AppRegistry: this is hardcoded for the time being
if c.AppName == "CodiMD" {
switch c.AppName {
case "CodiMD":
appURLs = getCodimdExtensions(c.AppURL)
} else if c.AppName == "Etherpad" {
case "Etherpad":
appURLs = getEtherpadExtensions(c.AppURL)
default:
return nil, errors.New("Application server " + c.AppName + " running at " + c.AppURL + " is unsupported")
}

}
return appURLs, nil
}
Expand Down Expand Up @@ -370,7 +371,7 @@ func getCodimdExtensions(appURL string) map[string]map[string]string {
func getEtherpadExtensions(appURL string) map[string]map[string]string {
appURLs := make(map[string]map[string]string)
appURLs["edit"] = map[string]string{
".etherpad": appURL,
".epd": appURL,
}
return appURLs
}

0 comments on commit ac1146a

Please sign in to comment.