Skip to content

Commit 4328310

Browse files
committed
Merge branch 'feature/add-share-permissions' of https://github.com/nextcloud/android into feature/add-share-permissions
2 parents fd49856 + a5a560a commit 4328310

57 files changed

Lines changed: 998 additions & 889 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:noble@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782
1+
FROM ubuntu:noble@sha256:1e622c5f073b4f6bfad6632f2616c7f59ef256e96fe78bf6a595d1dc4376ac02
22

33
ARG DEBIAN_FRONTEND=noninteractive
44
ENV ANDROID_HOME=/usr/lib/android-sdk

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ contact_links:
44
- name: 🚨 Report a security or privacy issue
55
url: https://hackerone.com/nextcloud
66
about: Report security and privacy related issues privately to the Nextcloud team, so we can coordinate the fix and release without potentially exposing all Nextcloud servers and users in the meantime.
7+
- name: 🚨 报告安全或隐私问题
8+
url: https://hackerone.com/nextcloud
9+
about: 请以私密方式向 Nextcloud 团队报告安全和隐私相关问题,以便我们能够协调修复工作并安排发布计划,避免在此期间可能暴露所有 Nextcloud 服务器和用户的风险。
710
- name: ❓ Community Support and Help
811
url: https://help.nextcloud.com/
912
about: Configuration, webserver/proxy or performance issues and other questions

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
with:
4444
swap-size-gb: 10
4545
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
46+
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
4747
with:
4848
languages: ${{ matrix.language }}
4949
- name: Set up JDK 17
@@ -57,4 +57,4 @@ jobs:
5757
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
5858
./gradlew assembleDebug
5959
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
60+
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242

4343
# Upload the results to GitHub's code scanning dashboard.
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
45+
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
4646
with:
4747
sarif_file: results.sarif

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343
run: scripts/uploadReport.sh "${{ secrets.LOG_USERNAME }}" "${{ secrets.LOG_PASSWORD }}" ${{github.event.number}} "test" "Unit" ${{github.event.number}}
4444
- name: Upload coverage to codecov
45-
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
45+
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
4646
with:
4747
token: ${{ secrets.CODECOV_TOKEN }}
4848
flags: unit

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ dependencies {
326326
implementation "com.googlecode.ez-vcard:ez-vcard:0.12.1"
327327
implementation "org.lukhnos:nnio:0.3.1"
328328
implementation "org.bouncycastle:bcpkix-jdk18on:1.80"
329-
implementation "com.google.code.gson:gson:2.12.1"
329+
implementation "com.google.code.gson:gson:2.13.1"
330330
implementation "com.github.nextcloud-deps:sectioned-recyclerview:0.6.1"
331331
implementation "com.github.chrisbanes:PhotoView:2.3.0"
332332
implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.29"
@@ -345,7 +345,7 @@ dependencies {
345345
huaweiImplementation project(":appscan")
346346
qaImplementation project(":appscan")
347347

348-
spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0"
348+
spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0"
349349
spotbugsPlugins "com.mebigfatguy.fb-contrib:fb-contrib:7.6.9"
350350

351351
implementation "com.google.dagger:dagger:$daggerVersion"
@@ -425,7 +425,7 @@ dependencies {
425425
implementation "com.github.stateless4j:stateless4j:2.6.0"
426426

427427
// upon each update first test: new registration, receive push
428-
gplayImplementation "com.google.firebase:firebase-messaging:24.1.0"
428+
gplayImplementation "com.google.firebase:firebase-messaging:24.1.1"
429429
gplayImplementation "com.google.android.gms:play-services-base:18.5.0"
430430
gplayImplementation "com.google.android.play:review-ktx:2.0.2"
431431

app/src/androidTest/java/com/owncloud/android/AbstractIT.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,19 +254,12 @@ protected static File getDummyFile(String name) throws IOException {
254254
file.mkdirs();
255255
return file;
256256
} else {
257-
switch (name) {
258-
case "empty.txt":
259-
return createFile("empty.txt", 0);
260-
261-
case "nonEmpty.txt":
262-
return createFile("nonEmpty.txt", 100);
263-
264-
case "chunkedFile.txt":
265-
return createFile("chunkedFile.txt", 500000);
266-
267-
default:
268-
return createFile(name, 0);
269-
}
257+
return switch (name) {
258+
case "empty.txt" -> createFile("empty.txt", 0);
259+
case "nonEmpty.txt" -> createFile("nonEmpty.txt", 100);
260+
case "chunkedFile.txt" -> createFile("chunkedFile.txt", 500000);
261+
default -> createFile(name, 0);
262+
};
270263
}
271264
}
272265

app/src/main/java/com/nextcloud/client/jobs/OfflineSyncWork.kt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import com.owncloud.android.utils.FileStorageUtils
2828
import java.io.File
2929

3030
@Suppress("LongParameterList") // Legacy code
31-
class OfflineSyncWork constructor(
31+
class OfflineSyncWork(
3232
private val context: Context,
3333
params: WorkerParameters,
3434
private val contentResolver: ContentResolver,
@@ -65,7 +65,7 @@ class OfflineSyncWork constructor(
6565
return
6666
}
6767

68-
val updatedEtag = checkEtagChanged(folderName, storageManager, user) ?: return
68+
val updatedEtag = checkETagChanged(folderName, storageManager, user) ?: return
6969

7070
// iterate over downloaded files
7171
val files = folder.listFiles { obj: File -> obj.isFile }
@@ -102,41 +102,39 @@ class OfflineSyncWork constructor(
102102
}
103103

104104
/**
105-
* @return new etag if changed, `null` otherwise
105+
* @return new eTag if changed, `null` otherwise
106106
*/
107-
private fun checkEtagChanged(folderName: String, storageManager: FileDataStorageManager, user: User): String? {
108-
val ocFolder = storageManager.getFileByPath(folderName) ?: return null
107+
private fun checkETagChanged(folderName: String, storageManager: FileDataStorageManager, user: User): String? {
108+
val folder = storageManager.getFileByEncryptedRemotePath(folderName) ?: return null
109109

110-
Log_OC.d(TAG, "$folderName: currentEtag: ${ocFolder.etag}")
110+
Log_OC.d(TAG, "$folderName: current eTag: ${folder.etag}")
111111

112112
// check for etag change, if false, skip
113-
val checkEtagOperation = CheckEtagRemoteOperation(
114-
ocFolder.remotePath,
115-
ocFolder.etagOnServer
116-
)
117-
val result = checkEtagOperation.execute(user, context)
113+
val operation = CheckEtagRemoteOperation(folder.remotePath, folder.etagOnServer)
114+
val result = operation.execute(user, context)
115+
118116
return when (result.code) {
119117
ResultCode.ETAG_UNCHANGED -> {
120118
Log_OC.d(TAG, "$folderName: eTag unchanged")
121119
null
122120
}
123121
ResultCode.FILE_NOT_FOUND -> {
124-
val removalResult = storageManager.removeFolder(ocFolder, true, true)
122+
val removalResult = storageManager.removeFolder(folder, true, true)
125123
if (!removalResult) {
126-
Log_OC.e(TAG, "removal of " + ocFolder.storagePath + " failed: file not found")
124+
Log_OC.e(TAG, "removal of " + folder.storagePath + " failed: file not found")
127125
}
128126
null
129127
}
130128
ResultCode.ETAG_CHANGED -> {
131129
Log_OC.d(TAG, "$folderName: eTag changed")
132-
result.data[0] as String
130+
result?.data?.get(0) as? String
133131
}
134132
else -> if (connectivityService.isInternetWalled) {
135133
Log_OC.d(TAG, "No connectivity, skipping sync")
136134
null
137135
} else {
138136
Log_OC.d(TAG, "$folderName: eTag changed")
139-
result.data[0] as String
137+
result?.data?.get(0) as? String
140138
}
141139
}
142140
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Nextcloud - Android Client
3+
*
4+
* SPDX-FileCopyrightText: 2025 Alper Ozturk <alper.ozturk@nextcloud.com>
5+
* SPDX-License-Identifier: AGPL-3.0-or-later
6+
*/
7+
8+
package com.nextcloud.utils.extensions
9+
10+
import com.owncloud.android.MainApp
11+
import com.owncloud.android.datamodel.OCFile
12+
import com.owncloud.android.utils.FileStorageUtils
13+
14+
fun List<OCFile>.filterFilenames(): List<OCFile> = distinctBy { it.fileName }
15+
16+
fun List<OCFile>.filterTempFilter(): List<OCFile> = filterNot { it.isTempFile() }
17+
18+
fun OCFile.isTempFile(): Boolean {
19+
val context = MainApp.getAppContext()
20+
val appTempPath = FileStorageUtils.getAppTempDirectoryPath(context)
21+
return storagePath?.startsWith(appTempPath) == true
22+
}
23+
24+
fun List<OCFile>.filterHiddenFiles(): List<OCFile> = filterNot { it.isHidden }.distinct()
25+
26+
fun List<OCFile>.filterByMimeType(mimeType: String): List<OCFile> =
27+
filter { it.isFolder || it.mimeType.startsWith(mimeType) }
28+
29+
fun List<OCFile>.limitToPersonalFiles(userId: String): List<OCFile> = filter { file ->
30+
file.ownerId?.let { ownerId ->
31+
ownerId == userId && !file.isSharedWithMe && !file.isGroupFolder
32+
} == true
33+
}

app/src/main/java/com/nextcloud/utils/extensions/StringExtensions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ object StringConstants {
3232
const val DOT = "."
3333
const val SPACE = " "
3434
const val THREE_DOT = "..."
35+
const val TEMP = "tmp"
3536
}
3637

3738
fun String.getContentOfPublicKey(): String {

0 commit comments

Comments
 (0)