Skip to content

chore: Add new file tree algo for api v2#232

Open
sirambd wants to merge 2 commits intov2-3-dbfrom
v2-4-file-tree
Open

chore: Add new file tree algo for api v2#232
sirambd wants to merge 2 commits intov2-3-dbfrom
v2-4-file-tree

Conversation

@sirambd
Copy link
Member

@sirambd sirambd commented Feb 6, 2026

Depends on #231

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

This PR/issue depends on:

@sonarqubecloud
Copy link

Comment on lines +56 to +60
// Skip duplicated separators
if (nextSlash == currentIndex) {
currentIndex++
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we bother testing for this case. Is this really something useful?

Comment on lines +52 to +54
var currentIndex = 0
while (currentIndex < lastSlash) {
val nextSlash = filePath.indexOf('/', currentIndex).takeIf { it != -1 } ?: lastSlash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could currentIndex and nextSlash be renamed into currentSlashIndex and nextSlashIndex to show they are the same things?

if (lastSlash <= 0) return null // No parent folder (root file)

var parentId: String? = null
val pathBuilder = StringBuilder(lastSlash)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to bother carrying a pathBuilder. We could simply substring filePath directly up to "nextSlash"

mimeType = null,
isFolder = true,
transferId = transferId,
folderId = parentId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't "parentFolderId" better than "folderId"? Some instances of FileDB represent a folder so having a field "folderId" can be confusing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments