Skip to content
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

Unable to upload file for particular "name" body parameter in upload URL #4606

Open
77neel opened this issue Mar 7, 2024 · 3 comments
Open
Labels
Milestone

Comments

@77neel
Copy link

77neel commented Mar 7, 2024

Describe the bug
upload fails due to file name
name pattern is like:
AAAAAA_ Bbbbbbb AAA ECD System Data Assessment _INDIA_ JO

With same named file or different named files uploaded with this "name" body parameter it fails for all and on changing the "name" value, it get uploaded.

error :

{
    "messages": [
        {
            "level": "ERROR",
            "message": "Internal server error: Unable to create CAS: null"
        }
    ]
}

To Reproduce
Steps to reproduce the behavior:

  1. Try to hit create document URL https://{{domain-name}}/api/aero/v1/projects/{{project-id}}/documents with need body parameter and "name" parameter must be above method

Expected behavior
File should get uploaded and document should be created against provided project.

Screenshots
createDocumentIssue

Please complete the following information:

  • Version and build ID: 30.0
  • OS: Windows
  • Browser: chrome and edge
@77neel
Copy link
Author

77neel commented Mar 8, 2024

Additional Finding :

When that file upload with method name using Inception document upload UI, it give error:

On UI bottom notification toast :

Error while uploading document [AAAAAA_ Bbbbbbb AAA ECD System Data Assessment _INDIA_ JO.pdf]:
 URISyntaxException: Illegal character in path at index 87:
 file:/C:/Users/admin-1234/.inception/repository/project/20/document/12/source/AAAAAA_ Bbbbbbb%20AAA%20ECD%20System%20Data%20Assessment%20_INDIA_%20JO.pdf

While Debuging, In catch block :

org.springframework.core.NestedIOException: Invalid URI
 [file:/C:/Users/admin-1234/.inception/repository/project/20/document/17/source/AAAAAA_ Bbbbbbb AAA ECD System Data Assessment _INDIA_ JO.pdf]; nested exception is java.net.URISyntaxException: Illegal character in path at index 87: 
file:/C:/Users/admin-1234/.inception/repository/project/20/document/17/source/AAAAAA_ Bbbbbbb%20AAA%20ECD%20System%20Data%20Assessment%20_INDIA_%20JO.pdf 

ErrorStack.txt

Thing to notice : Here it not replacing space with %20 in path after character "AAAAAA Bb"_

Note : Name of file has been changed, due security reason but pattern of file name is maintained.

@77neel
Copy link
Author

77neel commented Mar 11, 2024

This issue is generated due to non-printable character (NBSP) in file name.

nonpritable-character

Able to resolve it by replacing it

@reckart
Copy link
Member

reckart commented Mar 16, 2024

Looks like something that needs to be fixed in DKPro Core.

Caused by: java.net.URISyntaxException: Illegal character in path at index 99: file:/.../file-with- -nbsp.txt
	at java.base/java.net.URI$Parser.fail(URI.java:2974) ~[?:?]
	at java.base/java.net.URI$Parser.checkChars(URI.java:3145) ~[?:?]
	at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3227) ~[?:?]
	at java.base/java.net.URI$Parser.parse(URI.java:3175) ~[?:?]
	at java.base/java.net.URI.<init>(URI.java:623) ~[?:?]
	at org.springframework.util.ResourceUtils.toURI(ResourceUtils.java:381) ~[spring-core-5.3.32.jar:5.3.32]
	at org.springframework.util.ResourceUtils.toURI(ResourceUtils.java:370) ~[spring-core-5.3.32.jar:5.3.32]
	at org.springframework.core.io.AbstractResource.getURI(AbstractResource.java:125) ~[spring-core-5.3.32.jar:5.3.32]
	at org.springframework.core.io.UrlResource.getURI(UrlResource.java:216) ~[spring-core-5.3.32.jar:5.3.32]
	at org.dkpro.core.api.io.ResourceCollectionReaderBase.scan(ResourceCollectionReaderBase.java:527) ~[dkpro-core-api-io-asl-2.4.0.jar:?]
	at org.dkpro.core.api.io.ResourceCollectionReaderBase.initialize(ResourceCollectionReaderBase.java:241) ~[dkpro-core-api-io-asl-2.4.0.jar:?]
	at org.apache.uima.fit.component.CasCollectionReader_ImplBase.initialize(CasCollectionReader_ImplBase.java:41) ~[uimafit-core-3.5.0.jar:?]
	at org.apache.uima.collection.CollectionReader_ImplBase.initialize(CollectionReader_ImplBase.java:64) ~[uimaj-core-3.5.0.jar:?]
	at org.apache.uima.impl.CollectionReaderFactory_impl.produceResource(CollectionReaderFactory_impl.java:93) ~[uimaj-core-3.5.0.jar:?]
	at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:64) ~[uimaj-core-3.5.0.jar:?]
	at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:284) ~[uimaj-core-3.5.0.jar:?]
	at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:334) ~[uimaj-core-3.5.0.jar:?]
	at org.apache.uima.UIMAFramework.produceCollectionReader(UIMAFramework.java:805) ~[uimaj-core-3.5.0.jar:?]
	at org.apache.uima.fit.factory.CollectionReaderFactory.createReader(CollectionReaderFactory.java:423) ~[uimafit-core-3.5.0.jar:?]
	at de.tudarmstadt.ukp.clarin.webanno.api.format.FormatSupport.read(FormatSupport.java:180) ~[classes/:?]
	at de.tudarmstadt.ukp.inception.export.DocumentImportExportServiceImpl.importCasFromFileNoChecks(DocumentImportExportServiceImpl.java:334) ~[classes/:?]
	at de.tudarmstadt.ukp.inception.export.DocumentImportExportServiceImpl.importCasFromFileNoChecks(DocumentImportExportServiceImpl.java:314) ~[classes/:?]
	at de.tudarmstadt.ukp.inception.export.DocumentImportExportServiceImpl$$FastClassBySpringCGLIB$$6bf689d0.invoke(<generated>) ~[classes/:?]
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.32.jar:5.3.32]
	at org.springframework.aop.framework.CglibAopProxy.invokeMethod(CglibAopProxy.java:386) ~[spring-aop-5.3.32.jar:5.3.32]
	at org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85) ~[spring-aop-5.3.32.jar:5.3.32]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) ~[spring-aop-5.3.32.jar:5.3.32]
	at de.tudarmstadt.ukp.inception.export.DocumentImportExportServiceImpl$$EnhancerBySpringCGLIB$$5a9d5f27.importCasFromFileNoChecks(<generated>) ~[classes/:?]
	at de.tudarmstadt.ukp.inception.documents.DocumentServiceImpl.lambda$4(DocumentServiceImpl.java:815) ~[classes/:?]
	... 149 more

@reckart reckart added Requires upstream changes 🐛Bug Something isn't working labels Mar 16, 2024
@reckart reckart added this to the 33.0 milestone Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants