Hierarchical view incorrectly handling files in a subdirectory
Describe the bug Dataset has hierarchical directory structure with multiple subdirectories. One particular subdirectory is not being displayed properly. It contains 35 files.
Upon loading the dataset, the individual files are displayed but not in the correct subdirectory. When the next directory up is closed and then reopened, the files are no longer viewable.
The following screenshot shows the initial view. Note: the full path is /supplementary_data/visualizations/locations/. The locations subdirectory is missing.
This next screenshot shows the view after the /supplementary_data/visualizations subdirectory is closed and then opened again. Note: the Burn<#>_Plot.html files are no longer shown.
Desktop:
- OS: Mac OS 14.5
- Browser: FireFox 126.0.1
- Version 2.28.0
Additional context The downloaded dataset zip package has the correct directory structure.
I will attach the corresponding eml file in the following comment. The files are not sorted by directory, which @vchendrix and I believe should not matter.
eml file content: hierarchical-data-example-eml.txt
Thanks for the detailed report @dschristianson!
=
eml file content: hierarchical-data-example-eml.txt
@dschristianson this is actuall the resource map xml.
Thanks for the correction, @vchendrix!
Further details on this issue. It seems that there are subdirectories that have the same name those directories are omiited from the view.
Consider
Consider the following hierarchy where there are several sub directories named metadata
./Test-A
./Test-A/test-data-1mb.dat
./Test-A/metadata
./Test-A/metadata/flmd.csv
./README.md
./Test-C
./Test-C/test-data-1mb.dat
./Test-C/metadata
./Test-C/metadata/flmd.csv
./Test-B
./Test-B/test-data-1mb.dat
./Test-B/metadata
./Test-B/metadata/flmd.csv
Screenshot
Given this test dataset https://portal-demo.wfsi-data.org/view/doi%3A10.5072%2FFK29P37540
note that the metadata directory is missing from the view.
This issue is in DataPackageView.addFilesAndFolders
The algorithm in DataPackageView.addFilesAndFolders is keys the passed in arg, sortedFilePathObj by individual folder names which means that there only ever one parent for the sub directory metadata.
sortedFilePathObj this is passed into the js function
{
"": [
"wfsi-20241204T142642168641-4c9650328b48892",
"wfsi-20241204T223444303-a9c8d0a6a346c4f"
],
"Test-A": [
"wfsi-20241204T142643228234-971fef2a6dc9e72"
],
"Test-A/metadata": [
"wfsi-20241204T142642719179-874351c7deb64ab"
],
"Test-B": [
"wfsi-20241204T142644624152-cd7a2bcbabfe93b"
],
"Test-B/metadata": [
"wfsi-20241204T142644133339-403af611f1b4d7a"
],
"Test-C": [
"wfsi-20241204T142646035912-5df1d36d972959c"
],
"Test-C/metadata": [
"wfsi-20241204T142645512543-fbddfce261c91a1"
]
}
HI @vchendrix - thanks for the additional details. Yes, that seems like a logic error in the addFilesAndFolders, I'll work with Robyn to get this fix in for the upcoming release. Thank you! 🙏🏻