Commits

Anonymous committed 29824b1

PLE-954

  • Participants
  • Parent commits fe1593a
  • Branches default

Comments (0)

Files changed (1)

File com.atlassian.connector.eclipse.subclipse.ui/src/com/atlassian/connector/eclipse/internal/subclipse/ui/SubclipseTeamUiResourceConnector.java

 			// Crucible crashes if newContent is empty so ignore empty files (or mark them)
 			if (status.isUnversioned() || status.isAdded() || status.isIgnored()) {
 				byte[] newContent = getResourceContent((IFile) resource);
-				items.add(new UploadItem(fileName, new byte[0], newContent.length == 0 ? EMPTY_ITEM : newContent));
+				items.add(new UploadItem(fileName, UploadItem.DEFAULT_CONTENT_TYPE, UploadItem.DEFAULT_CHARSET,
+						new byte[0], getContentType((IFile) resource), getCharset((IFile) resource),
+						newContent.length == 0 ? EMPTY_ITEM : newContent));
 			} else if (status.isDeleted()) {
-				items.add(new UploadItem(fileName,
-						getResourceContent(svnResource.getBaseResource().getStorage(monitor)), DELETED_ITEM));
+				items.add(new UploadItem(fileName, getContentType((IFile) resource), getCharset((IFile) resource),
+						getResourceContent(svnResource.getBaseResource().getStorage(monitor)),
+						UploadItem.DEFAULT_CONTENT_TYPE, UploadItem.DEFAULT_CHARSET, DELETED_ITEM));
 			} else if (status.isDirty()) {
 				byte[] newContent = getResourceContent((IFile) resource);
-				items.add(new UploadItem(fileName,
+				items.add(new UploadItem(fileName, getContentType((IFile) resource), getCharset((IFile) resource),
 						getResourceContent(svnResource.getBaseResource().getStorage(monitor)),
+						getContentType((IFile) resource), getCharset((IFile) resource),
 						newContent.length == 0 ? EMPTY_ITEM : newContent));
 			}
 		}
 	}
 
 	public Collection<ScmRepository> getRepositories(IProgressMonitor monitor) {
-		ISVNRepositoryLocation[] repos = SVNUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations(
-				monitor);
+		ISVNRepositoryLocation[] repos = SVNUIPlugin.getPlugin()
+				.getRepositoryManager()
+				.getKnownRepositoryLocations(monitor);
 		List<ScmRepository> res = MiscUtil.buildArrayList(repos.length);
 		for (ISVNRepositoryLocation repo : repos) {
 			res.add(new ScmRepository(repo.getUrl().toString(), repo.getRepositoryRoot().toString(), repo.getLabel(),
 		return res;
 	}
 
+	@Override
+	protected String getContentType(IFile file) {
+		ISVNLocalResource local = file != null ? SVNWorkspaceRoot.getSVNResourceFor(file) : null;
+		ISVNProperty mimeType = null;
+		if (local != null) {
+			try {
+				mimeType = local.getSvnProperty(ISVNProperty.MIME_TYPE);
+			} catch (SVNException e) {
+			}
+		}
+		return mimeType != null ? mimeType.getValue() : super.getContentType(file);
+	}
 }