Fixed the issue that the sourcemap file was not caught after intercepting the read

issues:https://gitee.com/openharmony/ability_ability_runtime/issues/I77XPP

Signed-off-by: Rtangyu <rentangyu@huawei.com>
This commit is contained in:
Rtangyu 2023-05-24 15:25:25 +08:00
parent 97b14e77d3
commit 5b5b75ebd9

View File

@ -191,14 +191,12 @@ void SourceMap::SplitSourceMap(const std::string& sourceMapData)
std::string value;
while ((leftBracket = sourceMapData.find(": {", rightBracket)) != std::string::npos) {
rightBracket = sourceMapData.find("},", leftBracket);
uint32_t subLeftBracket = leftBracket;
uint32_t subRightBracket = rightBracket;
value = sourceMapData.substr(subLeftBracket + INDEX_ONE, subRightBracket - subLeftBracket + INDEX_TWO);
std::size_t sources = value.find("\"sources\": [");
value = sourceMapData.substr(leftBracket, rightBracket);
std::size_t sources = value.find("\"sources\": [");
if (sources == std::string::npos) {
continue;
}
std::size_t names = value.find("],");
std::size_t names = value.find("],", sources);
if (names == std::string::npos) {
continue;
}