| ... | @@ -532,8 +532,10 @@ fn runResource( | ... | @@ -532,8 +532,10 @@ fn runResource( |
| 532 | ) }); | 532 | ) }); |
| 533 | return error.FetchFailed; | 533 | return error.FetchFailed; |
| 534 | }; | 534 | }; |
| 535 | // Remove temporary directory root. | 535 | // Remove temporary directory root if not already renamed to cache. |
| 536 | cache_root.handle.deleteTree(tmp_dir_sub_path) catch {}; | 536 | if (!std.mem.eql(u8, package_sub_path, tmp_dir_sub_path)) { |
| | 537 | cache_root.handle.deleteDir(tmp_dir_sub_path) catch {}; |
| | 538 | } |
| 537 | | 539 | |
| 538 | // Validate the computed hash against the expected hash. If invalid, this | 540 | // Validate the computed hash against the expected hash. If invalid, this |
| 539 | // job is done. | 541 | // job is done. |
| ... | @@ -1059,6 +1061,10 @@ fn initResource(f: *Fetch, uri: std.Uri, server_header_buffer: []u8) RunError!Re | ... | @@ -1059,6 +1061,10 @@ fn initResource(f: *Fetch, uri: std.Uri, server_header_buffer: []u8) RunError!Re |
| 1059 | )); | 1061 | )); |
| 1060 | } | 1062 | } |
| 1061 | | 1063 | |
| | 1064 | /// A `null` return value indicates the `tmp_directory` is populated directly |
| | 1065 | /// with the package contents. |
| | 1066 | /// A non-null return value means that the package contents are inside a |
| | 1067 | /// sub-directory indicated by the named path. |
| 1062 | fn unpackResource( | 1068 | fn unpackResource( |
| 1063 | f: *Fetch, | 1069 | f: *Fetch, |
| 1064 | resource: *Resource, | 1070 | resource: *Resource, |