question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Comments:29 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
hikalkancommented, Dec 22, 2017

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.

1reaction
chanjunweimycommented, Dec 21, 2017

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found