Skip to content

Commit

Permalink
Ignore manifests with dot in start (#898)
Browse files Browse the repository at this point in the history
**Background**

Right now we're trying to load even those manifest files that are
created with a dot at the beginning - that's usually how they mark those
files that are deleted

**Changes**

- Add filter for start with point

**Test plan**

Try sync app
  • Loading branch information
LionZXY authored Jul 22, 2024
1 parent cfc3388 commit e895e19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [Feature] Infrared controls
- [Feature] Remove bond on retry pair
- [Feature] Add onetap widget
- [FIX] Ignore faps manifest with point in start

# 1.7.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class FapManifestCacheLoader @Inject constructor(
val namesWithHash = flipperStorageApi
.listingDirectoryWithMd5(FapManifestConstants.FAP_MANIFESTS_FOLDER_ON_FLIPPER)
.filter { File(it.name).extension == FapManifestConstants.FAP_MANIFEST_EXTENSION }
.filterNot { it.name.startsWith(".") }
val filesWithHash = getLocalFilesWithHash().associate { (file, md5) -> md5 to file }
info { "Find ${filesWithHash.size} files in cache" }
val cached = mutableListOf<Pair<File, String>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ class FapManifestsLoader @AssistedInject constructor(
val cacheResult = cacheLoader.loadCache()
info { "Cache load result is toLoad: ${cacheResult.toLoadNames}, cached: ${cacheResult.cachedNames}" }
val fapItemsList = mutableListOf<FapManifestItem>()
cacheResult.cachedNames.map { (file, name) ->
cacheResult.cachedNames.mapNotNull { (file, name) ->
parser.parse(file.readBytes(), name)
}.filterNotNull()
.filter { fapExistChecker.checkExist(it.path) }
}.filter { fapExistChecker.checkExist(it.path) }
.filter { it.isDevCatalog == isUseDevCatalog }
.forEach {
fapItemsList.add(it)
Expand All @@ -144,15 +143,12 @@ class FapManifestsLoader @AssistedInject constructor(
)
}
info { "Parsed ${fapItemsList.size} manifests from cache" }
cacheResult.toLoadNames
.map { name ->
loadManifestFile(
requestApi = serviceApi.requestApi,
filePath = File(FAP_MANIFESTS_FOLDER_ON_FLIPPER, name).absolutePath
)?.let { parser.parse(it, name) }
}
.filterNotNull()
.filter { fapExistChecker.checkExist(it.path) }
cacheResult.toLoadNames.mapNotNull { name ->
loadManifestFile(
requestApi = serviceApi.requestApi,
filePath = File(FAP_MANIFESTS_FOLDER_ON_FLIPPER, name).absolutePath
)?.let { parser.parse(it, name) }
}.filter { fapExistChecker.checkExist(it.path) }
.filter { it.isDevCatalog == isUseDevCatalog }
.forEach { content ->
fapItemsList.add(content)
Expand Down

0 comments on commit e895e19

Please sign in to comment.