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

change language code validation #3755

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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