From 410c87ed89b07afad8536d5c6ae9bb3ca7d9262d Mon Sep 17 00:00:00 2001 From: Jonah Jolley Date: Wed, 20 Feb 2019 21:08:58 -0700 Subject: [PATCH] Mac Osx clipboard can store items with \r, ensure we split on newline or carriage return --- service/port/port.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/port/port.py b/service/port/port.py index cad3dfae2..e21529f99 100644 --- a/service/port/port.py +++ b/service/port/port.py @@ -208,8 +208,8 @@ class Port(object): def importAuto(cls, string, path=None, activeFit=None, iportuser=None): # type: (Port, str, str, object, IPortUser) -> object # Get first line and strip space symbols of it to avoid possible detection errors - firstLine = re.split("[\n\r]+", string.strip(), maxsplit=1)[0] - firstLine = firstLine.strip() + splitLines = re.split("[\n\r]+", string.strip()) + firstLine = splitLines[0].strip() # If XML-style start of tag encountered, detect as XML if re.search(RE_XML_START, firstLine): @@ -237,7 +237,7 @@ class Port(object): # Assume that we import stand-alone abyssal module if all else fails try: - return "MutatedItem", (parseMutant(string.split("\n")),) + return "MutatedItem", (parseMutant(splitLines),) except: pass