diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java index 4a1b4bb65..5637996fd 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -1127,11 +1127,10 @@ public final class ActFmSyncService { currentFiles.remove(id); } else { // Create new file attachment + System.err.println("Got name: " + file.getString("name")); Metadata newAttachment = FileMetadata.createNewFileMetadata(model.getId(), null, file.getString("name"), file.getString("content_type")); String url = file.getString("url"); - if (url.contains("?")) - url = url.substring(0, url.lastIndexOf('?')); newAttachment.setValue(FileMetadata.URL, url); newAttachment.setValue(FileMetadata.REMOTE_ID, id); metadataService.save(newAttachment); diff --git a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java index 8cd774bfa..d6465f295 100644 --- a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java @@ -203,15 +203,7 @@ public class FilesControlSet extends PopupControlSet { @Override public void run() { String urlString = m.getValue(FileMetadata.URL); - String name; - if (urlString.endsWith("/")) - urlString = urlString.substring(0, urlString.length() - 1); - - int lastComponent = urlString.lastIndexOf('/'); - if (lastComponent > 0) - name = urlString.substring(lastComponent + 1); - else - name = urlString; + String name = m.getValue(FileMetadata.NAME); StringBuilder filePathBuilder = new StringBuilder(); filePathBuilder.append(activity.getExternalFilesDir(FileMetadata.FILES_DIRECTORY).toString()) .append(File.separator) @@ -290,7 +282,7 @@ public class FilesControlSet extends PopupControlSet { TextView nameView = (TextView) row.findViewById(R.id.file_text); TextView typeView = (TextView) row.findViewById(R.id.file_type); String name = getNameString(m); - String type = getTypeString(name); + String type = getTypeString(m.getValue(FileMetadata.NAME)); nameView.setText(name); if (TextUtils.isEmpty(type))