jfrog-client-go icon indicating copy to clipboard operation
jfrog-client-go copied to clipboard

Cannot follow example as UploadParams is not correctly initialized by NewUploadParams

Open beiriannydd opened this issue 5 years ago • 3 comments

In order to properly initialize UploadParams, it must include a new instance of the substructure included only as a reference within UploadParams.

Without it, you get a SIGSEGV when trying to write to uninitialized memory for eg. Pattern or ExcludePatterns

However, the code is:

    func NewUploadParams() UploadParams {
    	return UploadParams{}
    }

beiriannydd avatar Mar 28 '19 19:03 beiriannydd

A simple solution to this would be to remove the * and include the structure directly. I don't think UploadParams is remotely useful without the Common parameters.

beiriannydd avatar Mar 28 '19 20:03 beiriannydd

Thanks @beiriannydd for these suggestions. #50 is now merged into the dev branch and should resolve this issue for all types of params. As you can see there, we decided to initialize ArtifactoryCommonParams when creating the params objects. Your feedbacks are highly appreciated.

barbelity avatar Apr 02 '19 09:04 barbelity

@beiriannydd - the latest release includes this change.

eyalbe4 avatar Apr 18 '19 13:04 eyalbe4