Skip to content

Commit

Permalink
Display error message on UI download failed due to CORS not set prope…
Browse files Browse the repository at this point in the history
…rly #217
  • Loading branch information
Forceu committed Dec 11, 2024
1 parent 575d4a6 commit df95205
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/gokapi/Main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func initCloudConfig(passedFlags flagparser.MainFlags) {
encLevel := configuration.Get().Encryption.Level
env := environment.New()
corsCheckDisabled := passedFlags.DisableCorsCheck || env.DisableCorsCheck
if !corsCheckDisabled && (encLevel == encryption.FullEncryptionStored || encLevel == encryption.FullEncryptionInput) {
if !corsCheckDisabled && (encLevel == encryption.FullEncryptionStored || encLevel == encryption.FullEncryptionInput || encLevel == encryption.EndToEndEncryption) {
ok, err := aws.IsCorsCorrectlySet(cConfig.Aws.Bucket, configuration.Get().ServerUrl)
if err != nil {
fmt.Println("Warning: Cannot check CORS settings. " + err.Error())
Expand Down
8 changes: 7 additions & 1 deletion internal/webserver/web/templates/html_download.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@

pump();
} catch (err) {
displayError(err);
if (err.message.includes("Failed to fetch")) {
console.log(err);
displayError("Unable to download file. Please contact the uploader. Possible problem: Incorrect CORS rules, if using remote storage");

} else {
displayError(err);
}
}
}

Expand Down

0 comments on commit df95205

Please sign in to comment.