fix: preserve folder structure when pushing files#3
Open
admirkadriu wants to merge 1 commit intoaloth:mainfrom
Open
fix: preserve folder structure when pushing files#3admirkadriu wants to merge 1 commit intoaloth:mainfrom
admirkadriu wants to merge 1 commit intoaloth:mainfrom
Conversation
51cf727 to
701f9c4
Compare
`olcli push` previously uploaded all files to the project root, ignoring subdirectory structure (e.g. files in `figures/` or `sections/` would end up flattened at root level). This was caused by `uploadFile()` stripping the directory portion of the file path and always uploading to the root folder ID. The fix fetches the project's folder tree via Socket.IO before uploading, then resolves each file's directory to the correct Overleaf folder ID. Missing folders are created automatically via the folder API.
701f9c4 to
10db25e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
olcli pushcurrently uploads all files to the project root folder, ignoring subdirectory structure. For example, a file atfigures/image.pngorsections/intro.texends up at the root level on Overleaf instead of in its respective subfolder.Root cause:
uploadFile()inclient.tsstrips the directory portion of the file path (fileName.split('/').pop()) and always uploads to the root folder ID.Fix:
getFolderTreeFromSocket()to fetch the full folder hierarchy (path -> folder ID map) via the Socket.IOjoinProjectResponsepacketresolveFolderId()to look up or create missing folders on demanduploadFile()to accept an optionalfolderTreeparameter; when a file has a directory component, it resolves the correct subfolder ID instead of always using rootpushcommand to fetch the folder tree once before uploading and pass it to eachuploadFile()callBehavior:
main.tex) continue to upload to root as beforefigures/img.png) are now uploaded into the correct subfolderfolderTreeget the existing behaviorTest plan
figures/andsections/subdirectoriesnpm run build)🤖 Generated with Claude Code