openequella / openEQUELLA

Core openEQUELLA sources
https://openequella.github.io/
Apache License 2.0
41 stars 43 forks source link

Removing the unzipped files removes the zip file #1796

Open cbeach47 opened 4 years ago

cbeach47 commented 4 years ago

Describe the bug During an item contribution, after a zip file has been uploaded and unzipped, editing the zip file and removing the unzipped files removes the zip file, but not the attachment metadata.

This allows the zip file to appear like it's still part of that item contribution, but not have backing file.

To Reproduce Steps to reproduce the behavior:

  1. Start an item contribution
  2. Add a zip file
  3. unzip the file
  4. Remove the zipped files
  5. Try to access the zip file

Note: you don't have to publish the item to make it fail. Just get out of the edit file dialog between actions.

Note 2: The zipped files are not removed

Expected behavior Either the button should be named 'Remove ZIP file', and in that case, the metadata for the zip file should be removed

OR

Actually remove the unzipped files and don't mess with the zip file.

Interested on the community's take on which is the expected flow. Memory offers that there used to be a way to remove the zip file.

Screenshots image

Platform:

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

edalex-ian commented 3 years ago

I see @cathfitz has added this to the 2020.2 milestone, so I'll add the Edalex tag.

mrblippy commented 3 years ago

Hi Chris,

I have also been doing lots of testing with 2020.2, and it can only be reproduced in certain cases:

Working case The zip is kept after clicking 'unzip files', and then ‘remove unzipped files’ without exiting the dialog https://streamable.com/59dtw8

Non working case The zip is removed if you click ‘unzip files’, then exit the dialog, then click ‘edit’ to open up the dialog. The clicking 'remove unzipped files’ . Upon clicking save, there is a stacktrace in the logs too https://streamable.com/58vz3e

14:42:23,714 INFO [FileSystemHelper] Couldn't rename, copying then deleting instead 14:42:23,714 ERROR [FileSystemHelper] Error renaming file java.io.FileNotFoundException: /home/charlie/Charliequella/Dev/learningedge-config/data/filestore/Staging/89/91fb43a7-f7b9-4b68-8357-82a9475ba43c/_zips/_zips/equella-installer-6.5.zip (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at com.tle.common.filesystem.FileSystemHelper.copyRec(FileSystemHelper.java:216) at com.tle.common.filesystem.FileSystemHelper.copy(FileSystemHelper.java:177) at com.tle.common.filesystem.FileSystemHelper.rename(FileSystemHelper.java:132) at com.tle.core.services.impl.FileSystemServiceImpl.move(FileSystemServiceImpl.java:539) at com.tle.core.services.impl.FileSystemServiceImpl.move(FileSystemServiceImpl.java:544) at com.tle.web.controls.universal.FileStagingContext.moveFile(ControlContext.scala:98) at com.tle.web.controls.universal.handlers.FileUploadHandlerNew$AfterRegister$DetailsEditState.commit(FileUploadHandlerNew.scala:299) at com.tle.web.controls.universal.handlers.FileUploadHandlerNew$AfterRegister.editAttachment(FileUploadHandlerNew.scala:452) at com.tle.web.controls.universal.handlers.FileUploadHandlerNew.saveEdited(FileUploadHandlerNew.scala:192) at com.tle.web.controls.universal.UniversalResourcesDialog.saveClicked(UniversalResourcesDialog.java:361) at com.tle.web.controls.universal.UniversalResourcesDialog.save(UniversalResourcesDialog.java:586) at com.tle.web.controls.universal.handlers.fileupload.details.FileEditDetails.inplaceSave(FileEditDetails.scala:143) at sun.reflect.GeneratedMethodAccessor465.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.tle.web.sections.events.js.MethodInvocationEventGenerator$1.fireDirect(MethodInvocationEventGenerator.java:94) at com.tle.web.sections.events.AbstractDirectEvent.fire(AbstractDirectEvent.java:86) at com.tle.web.sections.generic.DefaultSectionInfo.processEvent(DefaultSectionInfo.java:420) at com.tle.web.sections.generic.DefaultSectionInfo.processEvent(DefaultSectionInfo.java:394) at com.tle.web.sections.generic.DefaultSectionInfo.processQueue(DefaultSectionInfo.java:388) at com.tle.web.sections.registry.AbstractSectionsController.execute(AbstractSectionsController.java:44) at com.tle.web.api.LegacyContentApi.$anonfun$submit$1(LegacyContentApi.scala:450) at com.tle.web.api.LegacyContentApi.withTreePath(LegacyContentApi.scala:318) at com.tle.web.api.LegacyContentApi.submit(LegacyContentApi.scala:447) at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:138) at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:543) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:432) at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:393) at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:395) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:364) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:337) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:440) at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229) at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135) at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358) at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:245) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:61) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) at com.tle.web.remoting.resteasy.RestEasyServlet.service(RestEasyServlet.java:140) at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) at com.tle.web.dispatcher.ServletDispatcher.dispatch(ServletDispatcher.java:95) at com.tle.web.dispatcher.RequestDispatchFilter.doFilter(RequestDispatchFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:880) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1601) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

I also went back to 6.5, before the attachment file upload code was rewritten, and i noticed the same functionality.

It seems like this is an actual bug, that we can't just get around by making a language string change