Skip to content

Commit

Permalink
Makin clientid and encryptionkey mandatory in encrypted share (#385)
Browse files Browse the repository at this point in the history
* initial commit

* deleted commented lines

* fixed a bug

* removed a log line

---------

Co-authored-by: Sinan Ekmekcibasi <[email protected]>
Co-authored-by: Kishan Dhakan <[email protected]>
Co-authored-by: Sinan Ekmekcibasi <[email protected]>
  • Loading branch information
4 people authored Mar 22, 2023
1 parent 553eaa0 commit 1a4790a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var shareCmd = &cobra.Command{
refType := fileref.FILE
statsMap, err := allocationObj.GetFileStats(remotepath)
if err != nil {
PrintError("Error in getting information about the object." + err.Error())
PrintError("Error fetching the file information", err)
os.Exit(1)
}

Expand All @@ -55,6 +55,19 @@ var shareCmd = &cobra.Command{
refType = fileref.DIRECTORY
}

if isFile {
fileMeta, err := allocationObj.GetFileMeta(remotepath)
if err != nil {
PrintError("Error in getting the file meta of the object." + err.Error())
os.Exit(1)
}

if len(fileMeta.EncryptedKey) > 0 && fflags.Changed("encryptionpublickey") == false {
PrintError("Clientid and/or encryptionpublickey are missing for the encrypted share!")
os.Exit(1)
}
}

var fileName string

_, fileName = filepath.Split(remotepath)
Expand Down

0 comments on commit 1a4790a

Please sign in to comment.