azu / azu/har-extractor

extractor sometimes tries to open an extant directory as a file

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
Type: Bug
Dominant language
TypeScript
Stars
133
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Thank you for this useful tool.

Excerpt of har file:
"request": {
"method": "POST",
"url": "https://archive.org/services/loans/beta/loan/",
...
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.16.1 (Ubuntu)"
},
{
"name": "Date",
"value": "Mon, 17 Aug 2020 01:31:25 GMT"
},
{
"name": "Content-Type",
"value": "application/json"
},
...

"request": {
"method": "POST",
"url": "https://archive.org/services/loans/beta/loan/",
...
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.16.1 (Ubuntu)"
},
{
"name": "Date",
"value": "Mon, 17 Aug 2020 01:31:25 GMT"
},
{
"name": "Content-Type",
"value": "application/json"
},
{
...

har-extractor creates a directory to hold a previous request, then tries to create a file of the same name to hold the second? Output:
...
illustrated/archive.org/services/loans/beta/loan/searchInside.php
illustrated/archive.org/services/loans/beta/loan
[illustratedsail&rigtuning.har.gz](https://github.com/azu/har-extractor/files/5084568/illustratedsail.rigtuning.har.gz)
{ Error: EISDIR: illegal operation on a directory, open 'illustrated/archive.org/services/loans/beta/loan'
at Object.openSync (fs.js:443:3)
at Object.writeFileSync (fs.js:1194:35)
at /usr/local/lib/node_modules/har-extractor/lib/har-extractor.js:48:16
at Array.forEach ()
at exports.extract (/usr/local/lib/node_modules/har-extractor/lib/har-extractor.js:35:28)
at Object. (/usr/local/lib/node_modules/har-extractor/bin/cmd.js:51:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
errno: -21,
syscall: 'open',
code: 'EISDIR',
path: 'illustrated/archive.org/services/loans/beta/loan' }

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lib/har-extractor.js around line 48 and trace how the HAR entries create directories and write files; bin/cmd.js shows the CLI entry point. Reproduce the EISDIR failure with the attached HAR, then verify extraction handles the conflicting path without trying to open a directory as a file.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.