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

Runtime error when extracting all resources from folder #33

Open
klfman opened this issue May 12, 2023 · 2 comments
Open

Runtime error when extracting all resources from folder #33

klfman opened this issue May 12, 2023 · 2 comments

Comments

@klfman
Copy link

klfman commented May 12, 2023

curl https://sandstorm.github.io/synco/serve | sh -s - just works, but when I try and download all files with curl https://sandstorm.github.io/synco/serve | sh -s - --all, the application crashes with a runtime error:

     INFO  collection 'persistent' is using target 'localWebDirectoryPersistentResourcesTarget'
     INFO  target 'localWebDirectoryPersistentResourcesTarget' is configured as follows: '{Target:Neos\Flow\ResourceManagement\Target\FileSystemSymlinkTarget TargetOptions:{Path:/app/Web/_Resources/Persistent/ BaseUri:_Resources/Persistent/ Bucket: KeyPrefix:}}'
     INFO  Extracting ALL resources for FileSystemTarget (path=/app/Web/_Resources/Persistent/, baseUri=_Resources/Persistent/)
     [1/3] ██████████████████████                                           33% | 4


spanic: runtime error: slice bounds out of range [:2] with length 1
    
    goroutine 1 [running]:
    github.com/sandstorm/synco/pkg/frameworks/flowServe.flowServe.extractAllResourcesFromFolder.func1({0xc005500a50, 0x41}, {0x9758f8?, 0xc005506270?}, {0x0?, 0x0?})
	    github.com/sandstorm/[email protected]/pkg/frameworks/flowServe/flowServe.go:309 +0x4ea
    path/filepath.walk({0xc005500a50, 0x41}, {0x9758f8, 0xc005506270}, 0xc00029b918)
	    path/filepath/path.go:480 +0x116
    path/filepath.walk({0xc00021f6c0, 0x1f}, {0x9758f8, 0xc0000ab6c0}, 0xc00029b918)
	    path/filepath/path.go:504 +0x26f
    path/filepath.Walk({0xc00021f6c0, 0x1f}, 0xc00029b918)
	    path/filepath/path.go:571 +0x6c
    github.com/sandstorm/synco/pkg/frameworks/flowServe.flowServe.extractAllResourcesFromFolder({}, 0xc20a60?, {0xc00021f6c0, 0x1f}, {0xc0002841c8, 0x16})
	    github.com/sandstorm/[email protected]/pkg/frameworks/flowServe/flowServe.go:279 +0xc7
    github.com/sandstorm/synco/pkg/frameworks/flowServe.flowServe.Serve({}, 0xc0000b2780)
	    github.com/sandstorm/[email protected]/pkg/frameworks/flowServe/flowServe.go:172 +0x41b
    github.com/sandstorm/synco/pkg/serve/cmd.glob..func1(0xc22740?, {0x8b92db?, 0x2?, 0x2?})
	    github.com/sandstorm/[email protected]/pkg/serve/cmd/source-cmd.go:61 +0x4da
    github.com/spf13/cobra.(*Command).execute(0xc22740, {0xc0000b8940, 0x2, 0x2})
	    github.com/spf13/[email protected]/command.go:920 +0x847
    github.com/spf13/cobra.(*Command).ExecuteC(0xc22460)
	    github.com/spf13/[email protected]/command.go:1044 +0x3bd
    github.com/spf13/cobra.(*Command).Execute(...)
	    github.com/spf13/[email protected]/command.go:968
    github.com/sandstorm/synco/lite/cmd-lite.Execute()
	    github.com/sandstorm/[email protected]/lite/cmd-lite/root-lite.go:45 +0x51
    main.main()
	    github.com/sandstorm/[email protected]/lite/main-lite.go:8 +0x17
@klfman
Copy link
Author

klfman commented May 12, 2023

The line in synco that throws the error is:
resourceFilesIndex["Resources/"+resourceSha1[0:1]+"/"+resourceSha1[1:2]+"/"+resourceSha1[2:3]+"/"+resourceSha1[3:4]+"/"+resourceSha1]

Could this be related to a breaking change in Neos 5.0 where the hash path segments in the pubic resource folder were reorganized?

https://docs.neos.io/api/upgrade-instructions/4/upgrade-instructions-4-3-5-0
section Settings subdivideHashPathSegment and relativeSymlinks enabled by default

The project is running Neos 7.0, but flow configuration:show shows that subdivideHashPathSegment: false is set in my project.

Looking at Neos/Flow/ResourceManagement/Target/FileSystemTarget.php there is a respective example that makes me think that:
"c/8/2/8/c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if subdivideHashPathSegment is on) or "c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if it's off)

@skurfuerst
Copy link
Member

@klfman I uess you are right :) Thanks, we can add support for it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants