Skip to content

Commit

Permalink
fix: encode doc name in doc-tab page
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Oct 6, 2017
1 parent 866928e commit ea5adaa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -928,10 +928,22 @@ public void setDefaultTranslationDocType(String fileName) {
translationFileUpload.setDocumentType(null);
}

/**
*
* @param sourceLocale
* @param docId - not encoded docId
* @return
*/
public String getEditorUrl(String sourceLocale, String docId) {
// encode into editor supported docId
String editorEncodedDocId = TokenUtil.encode(docId);

// encode into into {@code application/x-www-form-urlencoded} format
String encodedDocId = UrlUtil.encodeString(editorEncodedDocId);

return urlUtil.editorDocumentUrl(projectSlug, versionSlug,
selectedLocale.getLocaleId(),
LocaleId.fromJavaName(sourceLocale), TokenUtil.encode(docId));
LocaleId.fromJavaName(sourceLocale), encodedDocId);
}

public String encodeDocId(String docId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@

<ui:fragment rendered="#{hLocale.active}">
<a
href="#{request.contextPath}/webtrans/Application.xhtml?project=#{versionHomeAction.projectSlug}&amp;iteration=#{versionHomeAction.versionSlug}&amp;localeId=#{hLocale.localeId}&amp;locale=#{facesContext.externalContext.requestLocale}#{dswidParam}#view:doc;doc:#{versionHomeAction.selectedDocument.docId}">
href="#{request.contextPath}/webtrans/translate?project=#{versionHomeAction.projectSlug}&amp;iteration=#{versionHomeAction.versionSlug}&amp;localeId=#{hLocale.localeId}&amp;locale=#{facesContext.externalContext.requestLocale}#{dswidParam}#view:doc;doc:#{versionHomeAction.encodeDocId(versionHomeAction.selectedDocument.docId)}">
<div class="list__item">
<div class="list__item__info">
<h3 class="list__title">
Expand Down

0 comments on commit ea5adaa

Please sign in to comment.