title: Why did URL.createObjectURL start giving my file name as a GUID?
body: <p>This was working fine, and all of the sudden it doesn't.  History of relevant files revealed no obvious changes that would cause it.  Instead of having the real file name, say "upload.txt", I am getting a GUID with no extension.  So the browser can never open the file, and neither can the system when it downloads instead of opens.</p>
  
  <p>It's sending the filename correctly:</p>
  
  <p><a href="https://i.stack.imgur.com/pvBSS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pvBSS.png" alt="enter image description here"></a></p>
  
  <p>Server-side:</p>
  
  <pre><code>[HttpGet("download/{fileId}")]
      public async Task&lt;IActionResult&gt; DownloadFile(int fileId)
      {
          var file = await _fileRepository.GetByIdAsync(fileId).ConfigureAwait(true);
          if (file == null)
              return NotFound();
  
          var path = _fileService.GetUploadedFilePath(file.FileNameInStorage);
          if (!System.IO.File.Exists(path))
              return NotFound();
  
          var memory = await PopulateMemoryStream(path).ConfigureAwait(true);
          memory.Position = 0;
  
          var contentType = FileUtils.GetContentTypeByExtension(file.Extension);
          var displayName = file.OriginalFileName;
  
          if (!Path.HasExtension(displayName))
              displayName += file.Extension;
  
          System.Net.Mime.ContentDisposition cd = new System.Net.Mime.ContentDisposition
          {
              FileName = displayName,
              Inline = true  // false = prompt the user for downloading;  true = browser to try to show the file inline
          };
          Response.Headers.Add("Content-Disposition", cd.ToString());
          Response.Headers.Add("X-Content-Type-Options", "nosniff");
  
          return File(memory, contentType, displayName);
      }
  </code></pre>
  
  <p>Client-side:</p>
  
  <pre><code>  downloadFile(fileId: number): void {
  this.fileService.transmitFile(fileId).subscribe(res =&gt; {
    const fileURL = URL.createObjectURL(res);
    window.open(fileURL, '_blank');
  });
    }
  
  transmitFile(fileId: number): any {
  return this.http.get(`${this.apiUrl}/file/download/${fileId}`, { headers: { 'Accept': 'application/octet-stream' }, observe: 'response', responseType: 'arraybuffer' })
  .pipe(
    map((res) =&gt; {
      return new Blob([res.body], { type: res.headers.get('content-type') });
    })
  );
  </code></pre>
  
  <p>}</p>