Skip to content
Open
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
4 changes: 2 additions & 2 deletions app/src/main/java/com/owncloud/android/datamodel/OCFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,8 @@ public boolean isHidden() {
public long getLocalId() {
if (localId > 0) {
return localId;
} else if (remoteId != null && remoteId.length() > 8) {
return Long.parseLong(remoteId.substring(0, 8).replaceAll("^0*", ""));
} else if (remoteId != null) {
return Long.parseLong(remoteId.split("oc")[0]);
} else {
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package com.owncloud.android.datamodel

import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.Test

class OCFileTest {
Expand All @@ -22,9 +21,8 @@ class OCFileTest {
sut.remoteId = "00000008ocjycgrudn78"
assertEquals(8, sut.localId)

// this will fail as fileId is too large
sut.remoteId = "1234567891011ocjycgrudn78"
assertNotEquals(1234567891011L, sut.localId)
assertEquals(1234567891011L, sut.localId)

sut.localId = 1234567891011L
assertEquals(1234567891011L, sut.localId)
Expand Down
Loading