diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp index df09e47aa9469..d0850b800e4f9 100644 --- a/tools/aapt2/link/ManifestFixer.cpp +++ b/tools/aapt2/link/ManifestFixer.cpp @@ -69,7 +69,9 @@ static bool VerifyDeeplinkPathAttribute(xml::Element* data_el, android::SourcePa StringPiece attr_value = attr->value; const char* startChar = attr_value.begin(); if (attr_name == "pathPattern") { - if (*startChar == '/' || *startChar == '.' || *startChar == '*') { + // pathPattern starts with '.' or '*' does not need leading slash. + // Reference starts with @ does not need leading slash. + if (*startChar == '/' || *startChar == '.' || *startChar == '*' || *startChar == '@') { return true; } else { diag->Error(android::DiagMessage(data_el->line_number) @@ -80,7 +82,8 @@ static bool VerifyDeeplinkPathAttribute(xml::Element* data_el, android::SourcePa return false; } } else { - if (*startChar == '/') { + // Reference starts with @ does not need leading slash. + if (*startChar == '/' || *startChar == '@') { return true; } else { diag->Error(android::DiagMessage(data_el->line_number) diff --git a/tools/aapt2/link/ManifestFixer_test.cpp b/tools/aapt2/link/ManifestFixer_test.cpp index cec9a1a5917e3..8d1a647b494d8 100644 --- a/tools/aapt2/link/ManifestFixer_test.cpp +++ b/tools/aapt2/link/ManifestFixer_test.cpp @@ -1408,5 +1408,24 @@ TEST_F(ManifestFixerTest, IntentFilterPathMustStartWithLeadingSlashOnDeepLinks) )"; EXPECT_THAT(Verify(input), NotNull()); + + // DeepLink with string reference as a path. + input = R"( + + + + + + + + + + + + )"; + EXPECT_THAT(Verify(input), NotNull()); } } // namespace aapt