refactor(storage): refactoring storage#1459
Conversation
| var err error | ||
| if _, err = os.ReadDir(localRepoPath); os.IsNotExist(err) { | ||
| if err = os.MkdirAll(localRepoPath, local.DefaultDirPerms); err != nil { | ||
| if err = os.MkdirAll(localRepoPath, storageConstants.DefaultDirPerms); err != nil { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
|
|
||
| cachedRepoPath := path.Join(localCachePath, repo) | ||
| if err = os.MkdirAll(cachedRepoPath, local.DefaultDirPerms); err != nil { | ||
| if err = os.MkdirAll(cachedRepoPath, storageConstants.DefaultDirPerms); err != nil { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| ) types.ImageStore { | ||
| if _, err := os.Stat(rootDir); os.IsNotExist(err) { | ||
| if err := os.MkdirAll(rootDir, DefaultDirPerms); err != nil { | ||
| if err := os.MkdirAll(rootDir, storageConstants.DefaultDirPerms); err != nil { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| blobUploadPath := is.BlobUploadPath(repo, uid) | ||
|
|
||
| file, err := os.OpenFile(blobUploadPath, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, DefaultFilePerms) | ||
| file, err := os.OpenFile(blobUploadPath, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, storageConstants.DefaultFilePerms) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| } | ||
|
|
||
| file, err := os.OpenFile(blobUploadPath, os.O_WRONLY|os.O_CREATE, DefaultFilePerms) | ||
| file, err := os.OpenFile(blobUploadPath, os.O_WRONLY|os.O_CREATE, storageConstants.DefaultFilePerms) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| } | ||
|
|
||
| file, err := os.OpenFile(blobUploadPath, os.O_WRONLY|os.O_CREATE, DefaultFilePerms) | ||
| file, err := os.OpenFile(blobUploadPath, os.O_WRONLY|os.O_CREATE, storageConstants.DefaultFilePerms) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| func (is *ImageStoreLocal) writeFile(filename string, data []byte) error { | ||
| if !is.commit { | ||
| return os.WriteFile(filename, data, DefaultFilePerms) | ||
| return os.WriteFile(filename, data, storageConstants.DefaultFilePerms) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
| } | ||
|
|
||
| fhandle, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, DefaultFilePerms) | ||
| fhandle, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, storageConstants.DefaultFilePerms) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
|
|
||
| func ensureDir(dir string, log zerolog.Logger) error { | ||
| if err := os.MkdirAll(dir, DefaultDirPerms); err != nil { | ||
| if err := os.MkdirAll(dir, storageConstants.DefaultDirPerms); err != nil { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
c8cc3f8 to
b9ec429
Compare
Codecov Report
@@ Coverage Diff @@
## main #1459 +/- ##
==========================================
+ Coverage 90.97% 90.98% +0.01%
==========================================
Files 103 104 +1
Lines 22635 22639 +4
==========================================
+ Hits 20592 20599 +7
+ Misses 1522 1520 -2
+ Partials 521 520 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
442b5e5 to
1d25fb1
Compare
22c0705 to
99006bb
Compare
|
Besides my 2 remaining comments, the code looks good. |
ee9f59d to
7758a60
Compare
| @@ -51,8 +51,9 @@ import ( | |||
| "zotregistry.io/zot/pkg/log" | |||
| "zotregistry.io/zot/pkg/meta/repodb/repodbfactory" | |||
There was a problem hiding this comment.
we still use "factory"? why?
There was a problem hiding this comment.
Refactoring pkg/meta is out of scope of this PR.
7758a60 to
6423a59
Compare
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
edcfa2a
6423a59 to
edcfa2a
Compare
What type of PR is this?
Which issue does this PR fix:
#Closes
What does this PR do / Why do we need it:
If an issue # is not available please add repro steps and logs showing the issue:
Testing done on this change:
Automation added to e2e:
Will this break upgrades or downgrades?
Does this PR introduce any user-facing change?:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.