Illegal characters in path exception when saving MHTML as HTML with custom ResourceLoadingAction

Hello,

Saving the attached MHTML file to HTML with Aspose.Words for .NET 21.9, using a custom ResourceLoadingAction action to skip external resources, causes a “System.ArgumentException: Illegal characters in path” exception:

public static void Convert()
{
    var loadOpts = new Aspose.Words.Loading.LoadOptions
    {
        LoadFormat = Aspose.Words.LoadFormat.Mhtml,
        ResourceLoadingCallback = new WordDocImageHandler()
    };

    var word = new Aspose.Words.Document("input.mhtml", loadOpts);
    word.Save("output.html");
}

private class WordDocImageHandler : Aspose.Words.Loading.IResourceLoadingCallback
{
    public Aspose.Words.Loading.ResourceLoadingAction ResourceLoading(Aspose.Words.Loading.ResourceLoadingArgs args)
    {
        return Aspose.Words.Loading.ResourceLoadingAction.Skip;
    }
}

input.zip (12.2 KB)

If the ResourceLoadingAction is Default, it saves correctly. But having it set to Skip causes the “Illegal characters in path” exception.

This looks like a bug because it should just be skipping the resources. Can you please advise.

Thanks

@ast3,

For the sake of correction, we have logged this problem in our issue tracking system with ID WORDSNET-22750. We will further look into the details of this problem and will keep you updated here on the status of correction. We apologize for your inconvenience.

Hello,

I see the status is “WORDSNET-22750 ---- Status : Closed”. Has this issue been fixed in latest version?

Thanks

@ast3 The fix will be included into the upcoming 21.11 version of Aspose.Words, which will be released in a week or two. We will keep you informed and let you know once it is available.

The issues you have found earlier (filed as WORDSNET-22750) have been fixed in this Aspose.Words for .NET 21.11 update also available on NuGet.

Hi, this error is still happening in the latest version (Aspose Words .NET 23.7). The original MHTML file above now works, but the attached MTHML file throws the error: input.zip (4.3 KB)

@ast3
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25665

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as WORDSNET-25665) have been fixed in this Aspose.Words for .NET 23.10 update also available on NuGet.

I have checked and the file now processes without error, thank you!

1 Like