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

Makin clientid and encryptionkey mandatory in encrypted share #385

Merged
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
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