mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-21161 Check that index fragment of .format() string doesn't contain backslash
This commit is contained in:
+3
@@ -360,6 +360,9 @@ public class PyConvertToFStringIntention extends PyBaseIntentionAction {
|
||||
escaped.add(part);
|
||||
}
|
||||
else if (part.startsWith("[")) {
|
||||
if (part.contains("\\")) {
|
||||
return null;
|
||||
}
|
||||
final String indexText = part.substring(1, part.length() - 1);
|
||||
if (indexText.matches("\\d+")) {
|
||||
escaped.add(part);
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
'{0[\\]}'.format(undefined)
|
||||
+1
@@ -0,0 +1 @@
|
||||
'{0[\\]}'.format(undefined)
|
||||
@@ -99,6 +99,10 @@ public class PyConvertToFStringIntentionTest extends PyIntentionTestCase {
|
||||
public void testFormatMethodIndexContainsHostAlternativeQuote() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFormatMethodIndexContainsBackslash() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPercentOperatorWidthAndPrecision() {
|
||||
doTest();
|
||||
|
||||
Reference in New Issue
Block a user