Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Encode docId for download action in webtrans
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed May 26, 2015
1 parent d33de72 commit 6a02ca8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions docs/release-notes.md
Expand Up @@ -35,6 +35,7 @@ Example usage in html file: `<link rel="shortcut icon" href="#{assets['img/logo/
* [1222710](https://bugzilla.redhat.com/show_bug.cgi?id=1222710) - Editor option save fails due to ClassCastException
* [1222358](https://bugzilla.redhat.com/show_bug.cgi?id=1222358) - User profile page dropdown will not work in firefox
* [1165930](https://bugzilla.redhat.com/show_bug.cgi?id=1165930) - 'Copy from previous version' shows if an obsolete version exists
* [1098362](https://bugzilla.redhat.com/show_bug.cgi?id=1098362) - download link in editor doesn't encode properly and result in 404

-----------------------

Expand Down
Expand Up @@ -931,14 +931,6 @@ private void uploadAdapterFile(DocumentType docType) {
translationFileServiceImpl.removeTempFile(tempFile);
}

public String encodeDocId(String docId) {
return UrlUtil.encodeString(docId);
}

public String decodeDocId(String docId) {
return UrlUtil.decodeString(docId);
}

// Check if copy-trans, copy version or merge-trans is running for given
// version
public boolean isCopyActionsRunning() {
Expand Down
Expand Up @@ -21,6 +21,7 @@
import org.zanata.model.HProjectIteration;
import org.zanata.security.ZanataIdentity;
import org.zanata.service.TranslationFileService;
import org.zanata.util.UrlUtil;
import org.zanata.webtrans.server.ActionHandlerFor;
import org.zanata.webtrans.shared.model.AuditInfo;
import org.zanata.webtrans.shared.model.DocumentId;
Expand Down Expand Up @@ -73,14 +74,14 @@ public GetDocumentListResult execute(GetDocumentList action,
if (type == null) {
type = projectIteration.getProject().getDefaultProjectType();
}

String encodedDocId = UrlUtil.encodeString(hDoc.getDocId());
if (type == null) {
// no .po download link
} else if (type == ProjectType.Gettext || type == ProjectType.Podir) {
downloadExtensions.put(".po", "po?docId=" + hDoc.getDocId());
downloadExtensions.put(".po", "po?docId=" + encodedDocId);
} else {
downloadExtensions.put("offline .po",
"offlinepo?docId=" + hDoc.getDocId());
"offlinepo?docId=" + encodedDocId);
}
GlobalDocumentId id =
new GlobalDocumentId(iterationId.getProjectSlug(),
Expand All @@ -93,7 +94,7 @@ public GetDocumentListResult execute(GetDocumentList action,
iterationId.getIterationSlug(),
hDoc.getPath(), hDoc.getName());
downloadExtensions.put(extension,
"baked?docId=" + hDoc.getDocId());
"baked?docId=" + encodedDocId);
}

DocumentInfo doc =
Expand Down

0 comments on commit 6a02ca8

Please sign in to comment.