eahlys / EdPaste

Laravel/PHP-driven Pastebin with users management
MIT License
38 stars 14 forks source link

QueryException #3

Closed mis4s closed 6 years ago

mis4s commented 6 years ago

Hi,

I was trying to paste some zsh functions, then i got Exception. You can reproduce on https://paste.edra.ovh

Illuminate \ Database \ QueryException (HY000)
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x93\xB6 ...' for column 'content' at row 1 (SQL: insert into `pastes` (`link`, `userId`, `views`, `title`, `content`, `ip`, `expiration`, `privacy`, `password`, `noSyntax`, `burnAfter`, `updated_at`, `created_at`) values (FBaBrN0avI, 0, 0, Untitled, # find shorthand function f() { find . -name "$1" 2>&1 | grep -v 'Permission denied' } # Copy w/ progress cp_p () { rsync -WavP --human-readable --progress $1 $2 } # get gzipped size function gz() { echo "orig size (bytes): " cat "$1" | wc -c echo "gzipped size (bytes): " gzip -c "$1" | wc -c } # whois a domain or a URL function whois() { local domain=$(echo "$1" | awk -F/ '{print $3}') # get domain from URL if [ -z $domain ] ; then domain=$1 fi echo "Getting whois record for: $domain …" # avoid recursion # this is the best whois server # strip extra fluff /usr/bin/whois -h whois.internic.net $domain | sed '/NOTICE:/q' } function localip(){ function _localip(){ echo "📶 "$(ipconfig getifaddr "$1"); } export -f _localip local purple="\x1B\[35m" reset="\x1B\[m" networksetup -listallhardwareports | \ sed -r "s/Hardware Port: (.*)/${purple}\1${reset}/g" | \ sed -r "s/Device: (en.*)$/_localip \1/e" | \ sed -r "s/Ethernet Address:/📘 /g" | \ sed -r "s/(VLAN Configurations)|==*//g" } log() { git log --graph --color=always \ --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | fzf --ansi --no-sort --reverse --tiebreak=index --toggle-sort=\` \ --bind "ctrl-m:execute: echo '{}' | grep -o '[a-f0-9]\{7\}' | head -1 | xargs -I % sh -c 'git show --color=always % | less -R'" } , 188.146.71.157, 0, link, disabled, 0, 0, 2018-04-09 12:16:27, 2018-04-09 12:16:27))

Text:


# find shorthand
function f() {
    find . -name "$1" 2>&1 | grep -v 'Permission denied'
}

# Copy w/ progress
cp_p () {
  rsync -WavP --human-readable --progress $1 $2
}

# get gzipped size
function gz() {
    echo "orig size    (bytes): "
    cat "$1" | wc -c
    echo "gzipped size (bytes): "
    gzip -c "$1" | wc -c
}

# whois a domain or a URL
function whois() {
    local domain=$(echo "$1" | awk -F/ '{print $3}') # get domain from URL
    if [ -z $domain ] ; then
        domain=$1
    fi
    echo "Getting whois record for: $domain …"

    # avoid recursion
                    # this is the best whois server
                                                    # strip extra fluff
    /usr/bin/whois -h whois.internic.net $domain | sed '/NOTICE:/q'
}

function localip(){
    function _localip(){ echo "📶  "$(ipconfig getifaddr "$1"); }
    export -f _localip
    local purple="\x1B\[35m" reset="\x1B\[m"
    networksetup -listallhardwareports | \
        sed -r "s/Hardware Port: (.*)/${purple}\1${reset}/g" | \
        sed -r "s/Device: (en.*)$/_localip \1/e" | \
        sed -r "s/Ethernet Address:/📘 /g" | \
        sed -r "s/(VLAN Configurations)|==*//g"
}

log() {
  git log --graph --color=always \
      --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
  fzf --ansi --no-sort --reverse --tiebreak=index --toggle-sort=\` \
      --bind "ctrl-m:execute:
                echo '{}' | grep -o '[a-f0-9]\{7\}' | head -1 |
                xargs -I % sh -c 'git show --color=always % | less -R'"
}

And please disable APP_DEBUG on production :P

eahlys commented 6 years ago

Hi !

I just fixed it : utf8mb4 is now used for the pastes table :) Pull the lastest commit and run php artisan migrate from the command-line.

APP_DEBUG has been disabled in a previous commit in .env.example

Try this and tell me if it works !

mis4s commented 6 years ago

Thanks for fixes ;)

I mean to disable production on your demo paste https://paste.edra.ovh

https://imgur.com/a/Lhhfm