Skip to content

Commit 259bc4c

Browse files
authored
include field in osweb query (#2591)
* include field in osweb query * update fixtures
1 parent 1c2681d commit 259bc4c

4 files changed

+16
-2
lines changed

src/gateways/createOSWebLoader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const fields = [
4545
'book_subjects',
4646
'book_categories',
4747
'content_warning_text',
48-
// Should query require_login_message_text but it is not available yet
48+
'require_login_message_text',
4949
'id',
5050
].join(',');
5151

src/setupProxy.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,27 @@ const findFileIn = (baseDir, reqInfo) => {
9292
);
9393
const indexFilePath = path.join(filePath, 'index.html');
9494

95+
// For long filenames that exceed filesystem limits, also check for a hashed version
96+
const crypto = require('crypto');
97+
const queryHash = reqInfo.search
98+
? crypto.createHash('sha256').update(reqInfo.search).digest('hex')
99+
: '';
100+
const hashedQueryFilePath = queryHash
101+
? path.join(filePath, queryHash)
102+
: '';
103+
95104
if (isFile(queryFilePath)) {
96105
return queryFilePath;
106+
} else if (hashedQueryFilePath && isFile(hashedQueryFilePath)) {
107+
return hashedQueryFilePath;
97108
} else if (isFile(filePath)) {
98109
return filePath;
99110
} else if (isDirectory(filePath) && isFile(indexFilePath)) {
100111
return indexFilePath;
101112
} else {
102113
console.log(`did not find fixture file for ${reqInfo.url}, looked in:
103114
${queryFilePath}
115+
${hashedQueryFilePath}
104116
${filePath}
105117
${indexFilePath}
106118
`);
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"authors": [{"value": {"name": "Bam Bammerson"}}],
1717
"promote_image": null,
1818
"publish_date": "2012-06-21",
19-
"book_state": "live"
19+
"book_state": "live",
20+
"content_warning_text": "",
21+
"require_login_message_text": ""
2022
}
2123
]
2224
}

0 commit comments

Comments
 (0)