打开 关闭

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


User avatar
0
thaithiendi 创建

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 答案
  • User Avatar
    0
    liangshiwei 创建
    支持团队 Fullstack Developer

    hi,

    I will check it out.

  • User Avatar
    0
    liangshiwei 创建
    支持团队 Fullstack Developer

    Can you use chrome/edge open the pdf file?

  • User Avatar
    0
    thaithiendi 创建

    When i open with chrome

    I still use default code in backend

  • User Avatar
    0
    liangshiwei 创建
    支持团队 Fullstack Developer

    Hi,

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

  • User Avatar
    0
    thaithiendi 创建

    Hi,

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

  • User Avatar
    0
    liangshiwei 创建
    支持团队 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 创建

    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 创建
    支持团队 Fullstack Developer

    Hi,

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

  • User Avatar
    0
    thaithiendi 创建

    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 创建
    支持团队 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 创建

    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 创建

    Hi @thaithiendi

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

  • User Avatar
    0
    thaithiendi 创建

    Thanks Mehmet,

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

  • User Avatar
    0
    Mehmet 创建

    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 创建

    Hi,

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

  • User Avatar
    0
    liangshiwei 创建
    支持团队 Fullstack Developer

    Hi,

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

  • User Avatar
    0
    thaithiendi 创建

    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 创建
    支持团队 Fullstack Developer

    Hi,

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

  • User Avatar
    0
    ServiceBot 创建
    支持团队 Automatic process manager

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

Made with ❤️ on ABP v8.2.0-preview Updated on 三月 25, 2024, 15:11