Facing Problem when embedding file
See original GitHub issue- Your Abp package version: 3.0.0.0
- Your base framework: .Net Core.
EmbeddedResourceSet has bug if the embedded file has “-”
This is because of this segment of code:
private string ConvertToRelativePath(string resourceName) {
resourceName = resourceName.Substring(ResourceNamespace.Length + 1);
var pathParts = resourceName.Split('.');
if (pathParts.Length <= 2)
{
return resourceName;
}
var folder = pathParts.Take(pathParts.Length - 2).Select(NormalizeFolderName).JoinAsString("/");
var fileName = pathParts[pathParts.Length - 2] + "." + pathParts[pathParts.Length - 1];
return folder + "/" + fileName;
}
When pathParts.Length <= 2, the code did not normalize the string,
However, when retrieving fileinfo. EmbeddedResourceManager normalizes the string no matter when:
public EmbeddedResourceItem GetResource(string fullPath)
{
return _resources.Value.GetOrDefault(EmbeddedResourcePathHelper.NormalizePath(fullPath));
}
To reproduce it: Embed a file with “-” located in the root level, then try to get file info of it using EmbeddedResourceFileProvider
Expected: Get file info successfully Actual: File Info not found
Furthermore, since:
public IDirectoryContents GetDirectoryContents(string subpath)
{
if (!IsInitialized())
{
return new NotFoundDirectoryContents();
}
//TODO: Implement...?
return new NotFoundDirectoryContents();
}
May I ask if there is a plan to implement this method?
Thank you.
Issue Analytics
- State:
- Created 6 years ago
- Comments:29 (14 by maintainers)
Top Results From Across the Web
Word embedding issue
After installing latest Office updates, embedding files to Word document does not work anymore as expected. Embedded file icons are generic, ...
Read more >[Fixed!] Problems with Embedded Excel Files in PowerPoint
This article will help you on problems with embedded excel files in PowerPoint. It will also Facilitate you with 4 possible solutions.
Read more >Can't insert PDF as object into WORD
Only problem with "FoxIt workaround" is that PDF file is inserted with incorrect icon. To fix this in Insert -> Object -> Create...
Read more >"Cannot insert object" Error when inserting PDF files ...
Go to Insert Tab -> Object -> double click Package in the list of options -> then the "Create Package" dialog will appear...
Read more >7 Ways to Fix PowerPoint Cannot Insert a Video from the ...
The PowerPoint cannot insert a video from the selected file is a common problem faced by many. In this post, you can get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s very good and seems solving all problems: https://github.com/aspnet/FileSystem/issues/184#issuecomment-352907578
We will try it when MS releases.
@acjh Great to know! Thanks! ^^ @robsiera If you are still facing issue, as a workaround, you can implement the IFileProvider yourself, see: https://github.com/chanjunweimy/abp_plugin_with_ui/blob/master/aspnet-core/src/Todo.MainProject.Web.Host/Services/PluginEmbeddedResourceFileProvider.cs
Good luck!
Cheers, Jun Wei