Skip to content

Commit 2c567f2

Browse files
committed
Fix parameter substitution in Package pragma
commit_hash:df3312c03f97d33ee57c7ffd11a489097eb3c2d4
1 parent a382b5a commit 2c567f2

File tree

6 files changed

+18
-24
lines changed

6 files changed

+18
-24
lines changed

yql/essentials/ast/yql_expr.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,21 +1324,21 @@ namespace {
13241324
packageModuleName << Sep << part;
13251325
}
13261326

1327-
auto queue = TVector<std::pair<TString, THttpURL>> {
1328-
{packageModuleName, ParseURL(url)}
1327+
auto queue = TVector<std::pair<TString, TString>> {
1328+
{packageModuleName, url}
13291329
};
13301330

13311331
while (queue) {
1332-
auto [prefix, httpUrl] = queue.back();
1332+
auto [prefix, url] = queue.back();
13331333
queue.pop_back();
13341334

13351335
TVector<TUrlListEntry> urlListEntries;
13361336
try {
1337-
urlListEntries = ctx.UrlListerManager->ListUrl(httpUrl, token);
1337+
urlListEntries = ctx.UrlListerManager->ListUrl(url, token);
13381338
} catch (const std::exception& e) {
13391339
ctx.AddError(*nameNode,
13401340
TStringBuilder()
1341-
<< "UrlListerManager: failed to list URL \"" << httpUrl.PrintS()
1341+
<< "UrlListerManager: failed to list URL \"" << url
13421342
<< "\", details: " << e.what()
13431343
);
13441344

@@ -1356,7 +1356,7 @@ namespace {
13561356
}
13571357

13581358
if (!ctx.ModuleResolver->AddFromUrl(
1359-
moduleName, urlListEntry.Url.PrintS(), token, ctx.Expr,
1359+
moduleName, urlListEntry.Url, token, ctx.Expr,
13601360
ctx.SyntaxVersion, 0, nameNode->GetPosition()
13611361
)) {
13621362
return false;
@@ -3320,7 +3320,7 @@ ui64 MakePgExtensionMask(ui32 extensionIndex) {
33203320
if (!extensionIndex) {
33213321
return 0;
33223322
}
3323-
3323+
33243324
YQL_ENSURE(extensionIndex <= 64);
33253325
return 1ull << (extensionIndex - 1);
33263326
}

yql/essentials/core/url_lister/interface/url_lister.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include <library/cpp/uri/http_url.h>
4-
53
#include <util/generic/ptr.h>
64
#include <util/generic/string.h>
75
#include <util/generic/vector.h>
@@ -16,16 +14,16 @@ enum class EUrlListEntryType {
1614

1715

1816
struct TUrlListEntry {
19-
THttpURL Url;
17+
TString Url;
2018
TString Name;
2119
EUrlListEntryType Type;
2220
};
2321

2422

2523
class IUrlLister : public TThrRefBase {
2624
public:
27-
virtual bool Accept(const THttpURL& url) const = 0;
28-
virtual TVector<TUrlListEntry> ListUrl(const THttpURL& url, const TString& token) const = 0;
25+
virtual bool Accept(const TString& url) const = 0;
26+
virtual TVector<TUrlListEntry> ListUrl(const TString& url, const TString& token) const = 0;
2927
};
3028
using IUrlListerPtr = TIntrusivePtr<IUrlLister>;
3129

yql/essentials/core/url_lister/interface/url_lister_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace NYql {
1414

1515
class IUrlListerManager: public TThrRefBase {
1616
public:
17-
virtual TVector<TUrlListEntry> ListUrl(const THttpURL& url, const TString& tokenName) const = 0;
17+
virtual TVector<TUrlListEntry> ListUrl(const TString& url, const TString& tokenName) const = 0;
1818

1919
public:
2020
virtual TIntrusivePtr<IUrlListerManager> Clone() const = 0;

yql/essentials/core/url_lister/interface/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ SRCS(
66
)
77

88
PEERDIR(
9-
library/cpp/uri
109
library/cpp/yson/node
1110
yql/essentials/core/credentials
1211
yql/essentials/core/url_preprocessing/interface

yql/essentials/core/url_lister/url_lister_manager.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ class TUrlListerManager: public IUrlListerManager {
1616
}
1717

1818
public:
19-
TVector<TUrlListEntry> ListUrl(const THttpURL& url, const TString& tokenName) const override {
20-
auto urlString = SubstParameters(url.PrintS(), Parameters, nullptr);
19+
TVector<TUrlListEntry> ListUrl(const TString& url, const TString& tokenName) const override {
20+
auto urlWithoutParameters = SubstParameters(url, Parameters, nullptr);
21+
auto preprocessedUrl = urlWithoutParameters;
2122

2223
if (UrlPreprocessing) {
23-
auto [preprocessedUrlString, alias] = UrlPreprocessing->Preprocess(urlString);
24-
urlString = preprocessedUrlString;
24+
preprocessedUrl = UrlPreprocessing->Preprocess(urlWithoutParameters).first;
2525
}
2626

27-
auto patchedUrl = ParseURL(urlString);
28-
2927
TString token;
3028
if (tokenName) {
3129
if (!Credentials) {
@@ -41,12 +39,12 @@ class TUrlListerManager: public IUrlListerManager {
4139
}
4240

4341
for (const auto& urlLister: UrlListers) {
44-
if (urlLister->Accept(patchedUrl)) {
45-
return urlLister->ListUrl(patchedUrl, token);
42+
if (urlLister->Accept(preprocessedUrl)) {
43+
return urlLister->ListUrl(preprocessedUrl, token);
4644
}
4745
}
4846

49-
ythrow yexception() << "Unsupported package url: " << urlString;
47+
ythrow yexception() << "Unsupported package url: " << url;
5048
}
5149

5250
public:

yql/essentials/core/url_lister/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ SRCS(
77
PEERDIR(
88
yql/essentials/ast
99
yql/essentials/core/url_lister/interface
10-
yql/essentials/utils/fetch
1110
)
1211

1312
END()

0 commit comments

Comments
 (0)