zhanghai / zhanghai/MaterialFiles

Copied files owned by root - revisit

Open
#1,214 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
9k
Forks
736
PR merge metrics
No merged PRs in 30d

Description

There's no way Material Files can know you want the files to be owned by someone else

Actually, why don't you inherit from the parent folder?

I am not really qualified to judge stuff like this, but this patch...
Index: app/src/main/java/me/zhanghai/android/files/provider/common/PathExtensions.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/me/zhanghai/android/files/provider/common/PathExtensions.kt b/app/src/main/java/me/zhanghai/android/files/provider/common/PathExtensions.kt
--- a/app/src/main/java/me/zhanghai/android/files/provider/common/PathExtensions.kt	(revision 0901066958e90e7cb142a53770d46b895d4daa62)
+++ b/app/src/main/java/me/zhanghai/android/files/provider/common/PathExtensions.kt	(date 1714083652010)
@@ -49,6 +49,9 @@
     val provider = provider
     if (provider == target.provider) {
         provider.copy(this, target, *options)
+        if (target.getOwner().name == "root") {
+            target.setOwner(target.parent.getOwner())
+        }
     } else {
         ForeignCopyMove.copy(this, target, *options)
     }
... behaves much more useful to me.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in app/src/main/java/me/zhanghai/android/files/provider/common/PathExtensions.kt and review the same-provider copy path shown in the issue, alongside the linked ownership discussion. Done should mean copied files inherit the intended ownership from the parent folder instead of remaining owned by root.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.