Skip to content

Commit cc503d5

Browse files
P3nnymraerino
authored andcommitted
fix: allow asset url function to indicate skipping
If there are multiple web sources, the url function may want to indicate whether the current asset is available in its source, based on the asset. While sources are already filtered by asset type, there may be different properties that determine if a source is applicable. In our case, we use a special prefix on some projects to indicate a special source (like a special S3 location). The source will always be the first source, so we can be sure the prefixed projects are always loaded from the right source. But if the prefix is missing the url function should be able to indicate a skip by returning false. Throwing an error is not handled and results in a failure of the app.
1 parent 0d1abea commit cc503d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/WebHelper.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class WebHelper extends Helper {
6767

6868
if (urlFunction) {
6969
const url = urlFunction(asset);
70+
if (url === false) {
71+
tryNextSource();
72+
return;
73+
}
7074

7175
nets({url: url}, (err, resp, body) => {
7276
// body is a Buffer

0 commit comments

Comments
 (0)