Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15378717
D14170.id34237.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14170.id34237.diff
View Options
diff --git a/src/utils/PhutilCowsay.php b/src/utils/PhutilCowsay.php
--- a/src/utils/PhutilCowsay.php
+++ b/src/utils/PhutilCowsay.php
@@ -45,11 +45,13 @@
// (and any comments in the file) away.
$template = phutil_split_lines($template, true);
$keep = array();
+ $is_perl_cowfile = false;
foreach ($template as $key => $line) {
if (preg_match('/^#/', $line)) {
continue;
}
if (preg_match('/^\s*\\$the_cow/', $line)) {
+ $is_perl_cowfile = true;
continue;
}
if (preg_match('/^\s*EOC\s*$/', $line)) {
@@ -59,6 +61,16 @@
}
$template = implode('', $keep);
+ // Original .cow files are perl scripts which contain escaped sequences.
+ // We attempt to unescape here by replacing any character preceded by a
+ // backslash/escape with just that character.
+ if ($is_perl_cowfile) {
+ $template = preg_replace(
+ '/\\\\(.)/',
+ '$1',
+ $template);
+ }
+
$template = preg_replace_callback(
'/\\$([a-z]+)/',
array($this, 'replaceTemplateVariable'),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 4:31 PM (4 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7662116
Default Alt Text
D14170.id34237.diff (1 KB)
Attached To
Mode
D14170: Unescape sequences in .cow files which look like escaped sequences
Attached
Detach File
Event Timeline
Log In to Comment