Open Closed

PDF document is damaged when download from File management module #1574


User avatar
0
thaithiendi created

Hi support team,

When i download file from client like this I have error when open it from local

Please support to me

  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular):no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

19 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    hi,

    I will check it out.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Can you use chrome/edge open the pdf file?

  • User Avatar
    0
    thaithiendi created

    When i open with chrome

    I still use default code in backend

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can't reproduce the problem, can you share a project to reproduce? shiwei.liang@volosoft.com

  • User Avatar
    0
    thaithiendi created

    Hi,

    Thanks liangshiwei, I sent source code to your email. I am looking forward to hearing from u soon

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    This is a known issue and we have fixed, See https://github.com/abpframework/abp/pull/8253

    You can upgrade to ABP 4.3

  • User Avatar
    0
    thaithiendi created

    Hi, I upgraded ABP 4.2.2 to 4.3, and then i cannot start client side

    Please tell me how to fix it

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Check the migration guides: https://docs.abp.io/en/commercial/latest/migration-guides/v4_3

  • User Avatar
    0
    thaithiendi created

    Hi,

    I have aspnet-core and angular folders in the solution and I run "abp update" command in the parent folder of these two folders. And then I have updated according to the migration guides as your suggestion (Angular UI)

    But still error when i build angular project

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can use the following methods to quickly fix the problem:

    public class MyRemoteStreamContentOutputFormatter : OutputFormatter
    {
        public MyRemoteStreamContentOutputFormatter()
        {
            SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("*/*"));
        }
    
        protected override bool CanWriteType(Type type)
        {
            return typeof(IRemoteStreamContent).IsAssignableFrom(type);
        }
    
        public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
        {
            var remoteStream = (IRemoteStreamContent)context.Object;
            using (var stream = remoteStream.GetStream())
            {
                if (stream.CanSeek)
                {
                    stream.Position = 0;
                }
                await stream.CopyToAsync(context.HttpContext.Response.Body);
            }
        }
    }
    
     Configure<MvcOptions>(options =>
    {
        options.OutputFormatters.RemoveType<RemoteStreamContentOutputFormatter>();
        options.OutputFormatters.Insert(0, new MyRemoteStreamContentOutputFormatter());
    });
    
  • User Avatar
    0
    thaithiendi created

    Hi,

    I just built angular project.I haven't build backend yet. Error show in client side when i run "ng serve --o"

  • User Avatar
    0
    Mehmet created

    Hi @thaithiendi

    Please try to remove the node_modules folder and install the packages with the yarn command.

  • User Avatar
    0
    thaithiendi created

    Thanks Mehmet,

    I remove node_modules and reinstall, Angluar project built ok, but menu FileManagement is not displayed anymore.

  • User Avatar
    0
    Mehmet created

    Go to the http://localhost:4200/file-management URL manually, what do you see?

    If you see the 403 error page, please check the user's permission. If you see the 404 error page, please share app.module.ts and app-routing.module.ts files content so that I can find source of the problem.

  • User Avatar
    0
    thaithiendi created

    Hi,

    I see the 403 error, how to check user's permission. I cannot see menu to assign to user.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    File management is a feature, you can see the in the saas page.

  • User Avatar
    0
    thaithiendi created

    Hi, I can see Enable File management in Saas feature , But i don't see menu File managerment (i re-login).

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can I check it remotely? shiwei.liang@volosoft.com

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38