Skip to content

Commit

Permalink
fix: forced lowerCase transform on ansi file path (notwaldorf#125)
Browse files Browse the repository at this point in the history
When adding a custom filepath to (.profile|.bash_rc), the previous JS
code forced a lowerCase transformation on string stored in TTC_SAY_BOX.
If the string is a path to custom ansi art, and the user follows a capitalized
directory convention on their sys, the tranformed filepath would be wrong - resulting
in an error within the tiny-care-terminal. The fix: add a simple regex to check
if the string stored in the TTC_SAY_BOX env var is indeed a filepath, if it is,
then send that string; otherwise, proceed to transform the string.
  • Loading branch information
vinnyA3 authored and mojoaxel committed Oct 30, 2018
1 parent 312c62f commit b9658e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ var config = {
twitter: (process.env.TTC_BOTS || 'tinycarebot,selfcare_bot,magicrealismbot').toLowerCase().split(',').map(s => s.trim()),

// Use this to have a different animal say a message in the big box.
say: (process.env.TTC_SAY_BOX || 'parrot').toLowerCase(),
// regex: if TTC_SAY_BOX is a filePath, return that path
say: /(\w[~\/])/.test(process.env.TTC_SAY_BOX)
? process.env.TTC_SAY_BOX : (process.env.TTC_SAY_BOX || 'parrot').toLowerCase(),

// Set this to false if you want to scrape twitter.com instead of using
// API keys. The tweets may include RTs in this case :(
Expand Down

0 comments on commit b9658e9

Please sign in to comment.