@@ -52,8 +52,12 @@ func prepareFileSystemWithFluxSource(source sourcev1.Source, logger logr.Logger)
5252 // Update status with the reconciliation progress.
5353 // revision := source.GetArtifact().Revision
5454
55+ // Sanitize revision string by replacing invalid filesystem characters
56+ // Git artifact revisions contain characters like '/', ':', '@' which are not valid in directory names
57+ sanitizedRevision := strings .NewReplacer ("/" , "-" , ":" , "-" , "@" , "-" ).Replace (source .GetArtifact ().Revision )
58+
5559 // Create tmp dir.
56- tmpDir , err := os .MkdirTemp ("" , fmt .Sprintf ("kustomization-%s" , source . GetArtifact (). Revision ))
60+ tmpDir , err := os .MkdirTemp ("" , fmt .Sprintf ("kustomization-%s" , sanitizedRevision ))
5761 if err != nil {
5862 err = fmt .Errorf ("prepareFileSystemWithFluxSource: tmp dir error: %w" , err )
5963 return "" , err
@@ -130,13 +134,19 @@ func getReferencedFluxSourceFromURL(hc *configv1beta1.HelmChart) (*corev1.Object
130134 const repoURLParts = 2
131135 parts := strings .SplitN (hc .RepositoryURL , "://" , repoURLParts )
132136 if len (parts ) != repoURLParts {
133- return nil , "" , fmt .Errorf ("incorrect format: %q. Expected format sourceKind://sourceNamespace/sourceName/sourcePath" , hc .RepositoryURL )
137+ return nil , "" , fmt .Errorf (
138+ "incorrect format: %q. Expected format sourceKind://sourceNamespace/sourceName/sourcePath" ,
139+ hc .RepositoryURL ,
140+ )
134141 }
135142
136143 sourceKind := parts [0 ]
137144 remainingParts := strings .Split (parts [1 ], "/" )
138145 if len (remainingParts ) < 3 { //nolint: mnd // expected namespace, name and path
139- return nil , "" , fmt .Errorf ("incorrect format: %q. Expected format sourceKind://sourceNamespace/sourceName/sourcePath" , hc .RepositoryURL )
146+ return nil , "" , fmt .Errorf (
147+ "incorrect format: %q. Expected format sourceKind://sourceNamespace/sourceName/sourcePath" ,
148+ hc .RepositoryURL ,
149+ )
140150 }
141151
142152 sourceNamespace := remainingParts [0 ]
0 commit comments