From 24cdd41a9dfba152b7a10405600f6ae7b0072515 Mon Sep 17 00:00:00 2001 From: Ian Stevenson Date: Mon, 28 Oct 2024 17:54:49 +1100 Subject: [PATCH 1/6] fix(MyResourcesTest): add RetryTest This test is failing intermittently VERY often, and delaying builds. Attempts have been made to fix it, but it keeps failing. Let's try a RetryTest - that's exactly what it's for. OEQ-1982 --- .../java/com/tle/webtests/test/myresources/MyResourcesTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java index 2ad79413dc..7d34ccc9b3 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java @@ -17,6 +17,7 @@ import com.tle.webtests.test.AbstractCleanupTest; import com.tle.webtests.test.files.Attachments; import org.testng.annotations.Test; +import testng.annotation.RetryTest; /** * Test Reference: http://time/DTEC/test/editTest.aspx?testId=14957 Test Reference: @@ -25,6 +26,7 @@ * * @author larry, among others lost in the mists of time */ +@RetryTest @TestInstitution("myresources") public class MyResourcesTest extends AbstractCleanupTest { From f3355ab130827fd26f4cb2dceec863c4b5026684 Mon Sep 17 00:00:00 2001 From: Ian Stevenson Date: Tue, 29 Oct 2024 16:25:24 +1100 Subject: [PATCH 2/6] fix(MyResourcesTest): use a high number of retries On CI it has failed all 3 the first time we saw it retrying. Let's bump it slightly and see how that goes. OEQ-1982 --- .../java/com/tle/webtests/test/myresources/MyResourcesTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java index 7d34ccc9b3..3da901d36b 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/myresources/MyResourcesTest.java @@ -26,7 +26,7 @@ * * @author larry, among others lost in the mists of time */ -@RetryTest +@RetryTest(5) @TestInstitution("myresources") public class MyResourcesTest extends AbstractCleanupTest { From 90e3ff306f656b4a1b296ece78cb5ec82f9ca4cc Mon Sep 17 00:00:00 2001 From: Ian Stevenson Date: Thu, 31 Oct 2024 16:00:03 +1100 Subject: [PATCH 3/6] fix(WebDAV): ensure filenames are URL encoded for PROPFIND Although the filename was being URL decoded, when it was being returned in PROPFIND it was not being re-encoded and so spaces were problematic. OEQ-1740 --- .../src/com/tle/web/core/servlet/WebdavServlet.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/WebdavServlet.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/WebdavServlet.java index b0222e872a..e039b11ece 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/WebdavServlet.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/WebdavServlet.java @@ -24,6 +24,7 @@ import com.google.common.io.CharStreams; import com.rometools.utils.Strings; import com.tle.common.Check; +import com.tle.common.URLUtils; import com.tle.common.Utils; import com.tle.common.beans.exception.NotFoundException; import com.tle.common.filesystem.FileEntry; @@ -561,7 +562,7 @@ public void propFindMethod( return; } - String uri = basepath + '/' + staging.getUuid() + '/' + filename; + String uri = basepath + '/' + staging.getUuid() + '/' + URLUtils.urlEncode(filename); boolean isDir = fileSystemService.fileIsDir(staging, filename); // http://www.webdav.org/specs/rfc2518.html#collection.resources // folders should end with '/' From ac1f106421c1f1ef60014b34fc552031f69ceec4 Mon Sep 17 00:00:00 2001 From: Ian Stevenson Date: Thu, 31 Oct 2024 18:05:51 +1100 Subject: [PATCH 4/6] fix(WebDAV): return getlastmodified for files Some clients (such as cadaver) display errors when this is missing. OEQ-1740 --- .../com/tle/common/filesystem/FileEntry.java | 6 ++++ .../web/core/servlet/webdav/WebdavProps.java | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Source/Plugins/Core/com.equella.base/src/com/tle/common/filesystem/FileEntry.java b/Source/Plugins/Core/com.equella.base/src/com/tle/common/filesystem/FileEntry.java index 36df47ba98..fa3e4e6d86 100644 --- a/Source/Plugins/Core/com.equella.base/src/com/tle/common/filesystem/FileEntry.java +++ b/Source/Plugins/Core/com.equella.base/src/com/tle/common/filesystem/FileEntry.java @@ -30,6 +30,7 @@ public class FileEntry implements Serializable { private List files = new ArrayList(); private String name; private long length; + private String systemPath; public FileEntry(boolean folder) { this.folder = folder; @@ -39,6 +40,7 @@ public FileEntry(File file) { this.name = file.getName(); this.folder = file.isDirectory(); this.length = (this.folder ? 0 : file.length()); + this.systemPath = file.getAbsolutePath(); } public List getFiles() { @@ -73,6 +75,10 @@ public void setLength(long length) { this.length = length; } + public String getSystemPath() { + return systemPath; + } + public List foldToPaths() { final List paths = new ArrayList(); foldToPathsHelper(this, "", paths, false); // $NON-NLS-1$ diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/webdav/WebdavProps.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/webdav/WebdavProps.java index 180b38e816..68487e4e7d 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/webdav/WebdavProps.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/core/servlet/webdav/WebdavProps.java @@ -23,9 +23,15 @@ import com.tle.common.URLUtils; import com.tle.common.filesystem.FileEntry; import com.tle.core.mimetypes.MimeTypeService; +import java.io.File; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; /** @author aholland */ @@ -90,6 +96,7 @@ public void addFileProps(String parentName, FileEntry file) { addProp("resourcetype", ""); addProp("getcontenttype", mimeTypeService.getMimeTypeForFilename(filename)); addProp("getcontentlength", Long.toString(file.getLength())); + addProp("getlastmodified", getFileRFC1123Date(file)); addProp("iscollection", "0"); addProp("isfolder", "0"); addCommonProps(parentName, filename); @@ -119,4 +126,25 @@ private void addCommonProps(String parentName, String filename) { addProp("ishidden", "0"); addProp("isreadonly", "0"); } + + /** + * Get the RFC 1123 formatted date for the last modified date of the file entry as this is the + * format required by WebDAV. + * + * @param file The file entry to get the last modified date for + * @return The RFC 1123 formatted date for the last modified date of the file entry + */ + private static String getFileRFC1123Date(FileEntry file) { + final long lastModified = new File(file.getSystemPath()).lastModified(); + Instant lastModifiedInstant = Instant.ofEpochMilli(lastModified); + ZonedDateTime lastModifiedGMT = ZonedDateTime.ofInstant(lastModifiedInstant, ZoneId.of("GMT")); + + // Create a formatter for RFC 1123 format + DateTimeFormatter formatter = + DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH) + .withZone(ZoneId.of("GMT")); + + // Format the date and return + return lastModifiedGMT.format(formatter); + } } From 4f5a213287c288607a07c3d164394e6cf5782d0a Mon Sep 17 00:00:00 2001 From: Yinzi Xie Date: Tue, 5 Nov 2024 02:11:34 +0000 Subject: [PATCH 5/6] OEQ-1426 - fix: back to item summary page when canclling the edit new version session --- .../src/com/tle/web/wizard/WizardState.java | 15 +++++++++++++++ .../src/com/tle/web/wizard/command/Cancel.java | 8 ++++++++ .../tle/web/wizard/impl/WizardServiceImpl.java | 7 ++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/WizardState.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/WizardState.java index e7dd7e6dd8..70c4eb1b7d 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/WizardState.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/WizardState.java @@ -92,6 +92,9 @@ public enum Operation { private boolean lockedForEditing = false; private boolean mergeDRMDefaults = false; private boolean entryThroughEdit = false; + // Real version of the original item which indicates the new state is initiated through + // the option of "new version" in the summary page. + private int originalItemVer = 0; private boolean noCancel = false; private boolean newItem; private boolean movedItem; // changed collection @@ -482,4 +485,16 @@ public void setStateVersion(int stateVersion) { public int getStateVersion() { return stateVersion; } + + public int getOriginalItemVer() { + return originalItemVer; + } + + public void setOriginalItemVer(int originalItemVer) { + this.originalItemVer = originalItemVer; + } + + public boolean isEntryThroughNewVersion() { + return originalItemVer != 0; + } } diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/command/Cancel.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/command/Cancel.java index afc8ec7cbc..41a869b809 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/command/Cancel.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/command/Cancel.java @@ -20,6 +20,8 @@ import com.tle.beans.entity.FederatedSearch; import com.tle.beans.entity.itemdef.ItemDefinition; +import com.tle.beans.item.ItemId; +import com.tle.beans.item.ItemKey; import com.tle.common.Check; import com.tle.core.collection.service.ItemDefinitionService; import com.tle.core.fedsearch.FederatedSearchService; @@ -93,6 +95,12 @@ public void execute(SectionInfo info, WizardSectionInfo winfo, String data) thro // forward to viewing the item we are editing final ViewItemUrl vurl = viewItemUrl.createItemUrl(info, state.getItemId()); vurl.forward(info); + } else if (state.isEntryThroughNewVersion()) { + ItemKey newItemKey = state.getItemId(); + ItemKey originalItemKey = new ItemId(newItemKey.getUuid(), state.getOriginalItemVer()); + // forward to viewing the original item + final ViewItemUrl vurl = viewItemUrl.createItemUrl(info, originalItemKey); + vurl.forward(info); } else { if (forwardToContribute(info)) { // forward to contribute diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/impl/WizardServiceImpl.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/impl/WizardServiceImpl.java index 7c6fe2834c..aaa6715be2 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/impl/WizardServiceImpl.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/impl/WizardServiceImpl.java @@ -77,7 +77,11 @@ import com.tle.core.item.standard.operations.SaveOperation; import com.tle.core.item.standard.operations.workflow.StatusOperation; import com.tle.core.item.standard.service.MetadataMappingService; -import com.tle.core.plugins.*; +import com.tle.core.plugins.AbstractPluginService; +import com.tle.core.plugins.ClassBeanLocator; +import com.tle.core.plugins.FactoryMethodLocator; +import com.tle.core.plugins.PluginService; +import com.tle.core.plugins.PluginTracker; import com.tle.core.quota.service.QuotaService; import com.tle.core.scripting.service.StandardScriptContextParams; import com.tle.core.services.FileSystemService; @@ -448,6 +452,7 @@ public void newVersion(WizardState state) { } Item item = itemPack.getItem(); + state.setOriginalItemVer(itemKey.getVersion()); state.setMergeDRMDefaults(false); state.setItemPack(itemPack); state.setItemId(new ItemId(item.getUuid(), item.getVersion())); From 88fb291c6ddc6799eece7456caf0f2f93b5ba924 Mon Sep 17 00:00:00 2001 From: Penghai Date: Tue, 5 Nov 2024 16:00:05 +1100 Subject: [PATCH 6/6] chore: revert BIRT packages to v4.9.2 --- Source/Plugins/Core/com.equella.reporting/build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/Core/com.equella.reporting/build.sbt b/Source/Plugins/Core/com.equella.reporting/build.sbt index a755b9fc45..e814782225 100644 --- a/Source/Plugins/Core/com.equella.reporting/build.sbt +++ b/Source/Plugins/Core/com.equella.reporting/build.sbt @@ -4,13 +4,13 @@ lazy val Birt = config("birt") lazy val CustomCompile = config("compile") extend Birt libraryDependencies ++= Seq( - "com.github.openequella" % "birt-report-framework" % "4.16.0" artifacts Artifact( + "com.github.openequella" % "birt-report-framework" % "4.9.2" artifacts Artifact( "birt-report-framework", Artifact.DefaultType, "zip"), - "com.github.openequella" % "birt-osgi" % "4.16.0" artifacts Artifact("birt-osgi", - Artifact.DefaultType, - "zip"), + "com.github.openequella" % "birt-osgi" % "4.9.2" artifacts Artifact("birt-osgi", + Artifact.DefaultType, + "zip"), "com.github.equella.reporting" % "reporting-common" % "6.5", "com.github.equella.reporting" % "reporting-oda" % "6.5", "com.github.equella.reporting" % "reporting-oda-connectors" % "6.5",