I got the error when Add product video in product edit page without Embed video URL

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 年間の 前
Nop version 4.6 develop
I got the error when Add product video in product edit page without Embed video URL (and check log)
Please fix it aspe
-----------------------------------------------------------------
Exception
-----------------------------------------------------------------
System.NullReferenceException: Object reference not set to an instance of an object.
   at Nop.Web.Areas.Admin.Controllers.ProductController.ProductVideoAdd(Int32 productId, ProductVideoModel model) in C:\andrei\nopcommerce\demo_sites\sources\src\Presentation\Nop.Web\Areas\Admin\Controllers\ProductController.cs:line 1813
1 年間の 前
There is a work item for this.
1 年間の 前
Ok Mr.RomanovM 👍
1 年間の 前
[HttpPost]
        public virtual async Task<IActionResult> ProductVideoAdd(int productId, [Validate]
                         ProductVideoModel model)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageProducts))
                return AccessDeniedView();
            if (productId == 0)
                throw new ArgumentException();

            //try to get a product with the specified id
            var product = await _productService.GetProductByIdAsync(productId)
                ?? throw new ArgumentException("No product found with the specified id");
        
             var videoUrl = model?.VideoUrl?.TrimStart('~');

            try
            {
                if (!string.IsNullOrEmpty(model.VideoUrl))
                {
                    await PingVideoUrlAsync(videoUrl);
                }
                else
                {
                    return Json(new
                    {
                        success = false,
                        error = $"{await _localizationService.GetResourceAsync("Embed video URL is Empty")}",
                    });
                }
            }
1 年間の 前
I have tried to fix that and now working fine that ..........
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.