Skip to content
This repository was archived by the owner on Jul 18, 2022. It is now read-only.

Commit 8d2fe47

Browse files
committed
lookup thumbnail path in proper elasticsearch field
1 parent 6762942 commit 8d2fe47

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

backmeup-indexer-core/src/main/java/org/backmeup/index/sharing/execution/BackmeupFileStorageAccessManager.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import javax.inject.Inject;
77

88
import org.backmeup.index.ActiveUsers;
9+
import org.backmeup.index.api.IndexFields;
910
import org.backmeup.index.dal.UserMappingHelperDao;
1011
import org.backmeup.index.model.IndexDocument;
1112
import org.backmeup.index.utils.file.UserMappingHelper;
@@ -48,11 +49,11 @@ private boolean isBackmeupSinkStorage(IndexDocument doc) {
4849
public void addStorageFileAccessRights(Long fromUserId, Long withUserId, IndexDocument doc) throws IOException {
4950
//check if we're using backmeup storage as sink
5051
if (isBackmeupSinkStorage(doc)) {
51-
String filePath = doc.getFields().get("path").toString();
52+
String filePath = doc.getFields().get(IndexFields.FIELD_PATH).toString();
5253
String filePathThumbnail = null;
5354
//check if there is a thumbnail attached
54-
if (doc.getFields().get("thumbnail_path") != null) {
55-
filePathThumbnail = doc.getFields().get("thumbnail_path").toString();
55+
if (doc.getLargeFields().get(IndexFields.FIELD_THUMBNAIL_PATH) != null) {
56+
filePathThumbnail = doc.getLargeFields().get(IndexFields.FIELD_THUMBNAIL_PATH).toString();
5657
}
5758

5859
//check existing file access rights on storage for user and sharing partner
@@ -155,11 +156,11 @@ private boolean hasStorageFileAccessRight(Long fromUserId, Long withUserId, Stri
155156
public void removeStorageFileAccessRights(Long fromUserId, Long withUserId, IndexDocument doc) throws IOException {
156157
//check if we're using backmeup storage as sink
157158
if (isBackmeupSinkStorage(doc)) {
158-
String filePath = doc.getFields().get("path").toString();
159+
String filePath = doc.getFields().get(IndexFields.FIELD_PATH).toString();
159160
String filePathThumbnail = null;
160161
//check if there is a thumbnail attached
161-
if (doc.getFields().get("thumbnail_path") != null) {
162-
filePathThumbnail = doc.getFields().get("thumbnail_path").toString();
162+
if (doc.getLargeFields().get(IndexFields.FIELD_THUMBNAIL_PATH) != null) {
163+
filePathThumbnail = doc.getLargeFields().get(IndexFields.FIELD_THUMBNAIL_PATH).toString();
163164
}
164165
//check existing file access rights on storage for user and sharing partner
165166
boolean bAccessWithUser = withUserHasStorageFileAccessRight(fromUserId, withUserId, filePath);

0 commit comments

Comments
 (0)