Size of "sub" matches contents
Size of "sub" stays zero.
Entry in oc_filecache also has a size of zero.
Note that if you do the same without encryption it works fine.
So I suspect that some of the fileinfo size overrides code is messing up with folder size propagation.
This is bad because it could also doesn't update the share owner's root folder size, so the usage quota isn't updated properly.
Also the folder sizes cannot properly be corrected with occ files:scan because of encrypted size vs unencrypted size! seems to work fine. occ:files:scan can be used to repair those folder sizes.
Bisect was tough due to many internal server errors on the way.
It pointed at this commit: 1369f2c from PR #21851
Before that commit, even though the upload fails with 500 error, the folder size is correctly updated.
After that commit, the folder size is either -1 or 0. So not sure if that commits is directly related or if there is something else at play.
@icewind1991 can you have a look ?
Ok, could reproduce in a unit test
Fix is here #24124