Skip to content

Correctly resolve template path #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions gxoffice/src/main/java/com/genexus/gxoffice/ExcelDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,29 +113,31 @@ public String getDefaultPath() {
String template = "";

public void setTemplate(String p1) {
File path = new File(p1);
String resolvedPath = p1;
File pathFile = new File(p1);

if (com.genexus.ModelContext.getModelContext() != null) {
com.genexus.internet.HttpContext webContext = (com.genexus.internet.HttpContext) com.genexus.ModelContext
.getModelContext().getHttpContext();
if ((webContext != null) && (webContext instanceof com.genexus.webpanels.HttpContextWeb)) {
if (!path.isAbsolute()) {
p1 = ((com.genexus.webpanels.HttpContextWeb) webContext).getRealPath(p1);
if (!pathFile.isAbsolute()) {
resolvedPath = ((com.genexus.webpanels.HttpContextWeb) webContext).getRealPath(p1);
}
}
}

if (makeExternalUpload) {
String localTemplate = p1;
if (path.isAbsolute())
p1 = path.getName().toString();
GXFile template = new GXFile(p1);
if (!template.exists()) {
Application.getExternalProvider().upload(localTemplate, p1, ResourceAccessControlList.Default);
String localTemplateForUpload = resolvedPath;
String remoteFileName = new File(resolvedPath).getName();

GXFile templateFile = new GXFile(resolvedPath);
if (!templateFile.exists()) {
Application.getExternalProvider().upload(localTemplateForUpload, remoteFileName, ResourceAccessControlList.Default);
}
}
template = p1;
template = resolvedPath;
if (document != null) {
document.setTemplate(p1);
document.setTemplate(resolvedPath);
}
}

Expand Down
Loading