@@ -230,6 +230,22 @@ func (pm *PackageManager) Create(opts PackageCreateOpts) (string, error) {
230
230
return status .Path , nil
231
231
}
232
232
233
+ func DetermineFilterRoot (contentPath string ) string {
234
+ _ , filterRoot , _ := strings .Cut (contentPath , content .JCRRoot )
235
+ filterRoot = strings .ReplaceAll (filterRoot , "\\ " , "/" )
236
+ if strings .HasSuffix (filterRoot , content .JCRContentFile ) && content .IsContentFile (contentPath ) {
237
+ filterRoot = strings .ReplaceAll (filterRoot , content .JCRContentFile , content .JCRContentNode )
238
+ } else if strings .HasSuffix (filterRoot , content .JCRContentFile ) {
239
+ filterRoot = filepath .Dir (filterRoot )
240
+ } else if strings .HasSuffix (filterRoot , content .XmlFileSuffix ) {
241
+ filterRoot = strings .ReplaceAll (filterRoot , content .XmlFileSuffix , "" )
242
+ }
243
+ filterRoot = namespacePatternRegex .ReplaceAllString (filterRoot , "/$2:" )
244
+ filterRoot = strings .ReplaceAll (filterRoot , "/__" , "/_" )
245
+ filterRoot = strings .ReplaceAll (filterRoot , "%3a" , ":" )
246
+ return filterRoot
247
+ }
248
+
233
249
func copyContentFiles (contentPath string , tmpDir string ) error {
234
250
_ , jcrPath , _ := strings .Cut (contentPath , content .JCRRoot )
235
251
if pathx .IsDir (contentPath ) {
@@ -253,22 +269,6 @@ func copyContentFiles(contentPath string, tmpDir string) error {
253
269
return nil
254
270
}
255
271
256
- func DetermineFilterRoot (contentPath string ) string {
257
- _ , filterRoot , _ := strings .Cut (contentPath , content .JCRRoot )
258
- filterRoot = strings .ReplaceAll (filterRoot , "\\ " , "/" )
259
- if strings .HasSuffix (filterRoot , content .JCRContentFile ) && content .IsContentFile (contentPath ) {
260
- filterRoot = strings .ReplaceAll (filterRoot , content .JCRContentFile , content .JCRContentNode )
261
- } else if strings .HasSuffix (filterRoot , content .JCRContentFile ) {
262
- filterRoot = filepath .Dir (filterRoot )
263
- } else if strings .HasSuffix (filterRoot , content .XmlFileSuffix ) {
264
- filterRoot = strings .ReplaceAll (filterRoot , content .XmlFileSuffix , "" )
265
- }
266
- filterRoot = namespacePatternRegex .ReplaceAllString (filterRoot , "/$2:" )
267
- filterRoot = strings .ReplaceAll (filterRoot , "/__" , "/_" )
268
- filterRoot = strings .ReplaceAll (filterRoot , "%3a" , ":" )
269
- return filterRoot
270
- }
271
-
272
272
func (pm * PackageManager ) Copy (remotePath string , destInstance * Instance ) error {
273
273
var localPath = pathx .RandomFileName (pm .tmpDir (), "pkg_copy" , ".zip" )
274
274
defer func () {
0 commit comments