curran / curran/google-diff-match-patch

[JS] patch_fromText breaks on IE8

Offen
#74 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
auto-migrated Priority-Medium Type-Defect
Vorherrschende Sprache
Python
Sterne
17
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

```
What steps will reproduce the problem?
1. Performs patch_fromText on a diff string.
2. The diff string is:

var diffString = "@@ -3,14 +3,12 @@\n mple\n-st\n co\n-nt\n+mm\n ent\n"

3. var patches = dmp.patch_fromText(diffString);

What is the expected output? What do you see instead?

The array of patches object. But I see nothing, and IE8 gives an error of
"Invalid patch string: @@ -3,14 +3,12 @@"

What version of the product are you using? On what operating system?
I'm using diff_match_patch_20120106.zip, on Windows XP with IE8.

Please provide any additional information below.

I traced down to the issue that IE8 or below appends \r into the string.
Therefore, on line 2062 of the uncompressed version, when only splitting on \n,
it will fail and thus can't match with the regex for patchHeader.

I modified line 2062 to the below and it works:

var text = textline.split(/\r\n|\r|\n/);
```

Original issue reported on code.google.com by `ese...@gmail.com` on 21 Jun 2012 at 3:17

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Öffne die unkomprimierte JavaScript-Implementierung ungefähr bei Zeile 2062 und verfolge patch_fromText mit dem bereitgestellten Diff-String in IE8. Erledigt ist es, wenn der String ohne den Fehler „Invalid patch string“ in das erwartete Patch-Array geparst wird; überprüfe die bereitgestellte Reproduktion in IE8.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.