Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ internal class SharedListFragmentIT : AbstractIT() {
fragment.mEmptyListContainer?.visibility = View.GONE

val newList = runBlocking {
OCShareToOCFileConverter.parseAndSaveShares(shares, storageManager, user.accountName)
OCShareToOCFileConverter
.parseAndSaveShares(listOf(), shares, storageManager, user.accountName)
}
fragment.adapter.run {
prepareForSearchData(storageManager, SearchType.SHARED_FILTER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object OCShareToOCFileConverter {
.filter { !it.path.isNullOrEmpty() }
.groupBy { it.path!! }
.filterKeys { path ->
path.isNotEmpty() && !path.startsWith(OCFile.PATH_SEPARATOR)
path.isNotEmpty() && path.startsWith(OCFile.PATH_SEPARATOR)
}
.map { (path, sharesForPath) ->
buildOcFile(path, sharesForPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import java.io.File
import java.nio.file.Files
import java.nio.file.attribute.FileTime

@Suppress("MagicNumber")
class AutoUploadHelperTest {

private lateinit var tempDir: File
Expand Down Expand Up @@ -191,6 +192,11 @@ class AutoUploadHelperTest {

val hiddenDir = File(tempDir, ".hidden_dir")
hiddenDir.mkdirs()
try {
Files.setAttribute(hiddenDir.toPath(), "dos:hidden", true)
} catch (_: Exception) {
}

File(hiddenDir, "file.txt").writeText("Hidden dir file")

// Create regular file
Expand Down Expand Up @@ -268,13 +274,16 @@ class AutoUploadHelperTest {
val oldFile = File(tempDir, "old_file.txt").apply {
writeText("Old file")
}

val oldFilePath = oldFile.toPath()
Files.setAttribute(
oldFilePath,
"creationTime",
FileTime.fromMillis(currentTime - 60_000) // 1 minute before enabling
)

Thread.sleep(1000)

// New file (created after enabling auto-upload)
val newFile = File(tempDir, "new_file.txt").apply {
writeText("New file")
Expand All @@ -283,7 +292,7 @@ class AutoUploadHelperTest {
Files.setAttribute(
newFilePath,
"creationTime",
FileTime.fromMillis(currentTime + 1_000) // 1 second after enabling
FileTime.fromMillis(currentTime + 60_000) // 1 minute after enabling
)

val folderSkipOld = createTestFolder(
Expand Down
Loading