Skip to content

Commit

Permalink
Merge pull request #3755 from micbar/fix-lang-app-open
Browse files Browse the repository at this point in the history
change language code validation
  • Loading branch information
micbar committed Mar 28, 2023
2 parents 36c2ef9 + b267842 commit 9bafcee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-app-provider-lang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix app provider language validation

This changes the validation to only look at the first part (tag) of the language code and ignore the second part (sub-tag).


https://github.com/cs3org/reva/pull/3755
5 changes: 3 additions & 2 deletions internal/http/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,9 @@ func (s *svc) handleOpen(openMode int) http.HandlerFunc {
}

lang := r.Form.Get("lang")
if lang != "" && !iso6391.ValidCode(lang) {
writeError(w, r, appErrorInvalidParameter, "lang parameter does not contain a valid ISO 639-1 language code", nil)
parts := strings.Split(lang, "_")
if lang != "" && !iso6391.ValidCode(parts[0]) {
writeError(w, r, appErrorInvalidParameter, "lang parameter does not contain a valid ISO 639-1 language code in the language tag", nil)
return
}

Expand Down

0 comments on commit 9bafcee

Please sign in to comment.