• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Image name/Path not stripping all illegal chars

Scheduled Pinned Locked Moved Solved
FOG Problems
3
5
595
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    andyb2000
    last edited by Jan 25, 2018, 3:50 PM

    This appears a fairly simple one, when creating a new image, image name (iName) takes any characters, which then does a regular expression replace to fill in the iFile input box with the Image Path to be created.
    It doesn’t escape/remove all illegal characters, one such character is the forward-slash which then causes filesystem issues during the FTP rename component.

    Tested using Image Name of “MyTest-25/01/18” which then gets the image path filled out to /images/mytest-25/01/18
    When image is captured the process fails at the FTP segment, raw ftp logs show the rename failing:

    Thu Jan 25 15:27:40 2018 [pid 28283] [fog] FTP command: Client "172.16.4.1", "RNFR /images/dev/18a905f6e4ae"
    Thu Jan 25 15:27:40 2018 [pid 28283] [fog] FTP response: Client "172.16.4.1", "350 Ready for RNTO."
    Thu Jan 25 15:27:40 2018 [pid 28283] [fog] FTP command: Client "172.16.4.1", "RNTO /images/mytest-25/01/18"
    Thu Jan 25 15:27:40 2018 [pid 28283] [fog] FTP response: Client "172.16.4.1", "550 Rename failed."
    

    (Obviously due to the forward slash being a directory command in Linux).

    Code in question:
    fog/management/js/fog/fog.image.js

        $('#iName').on('change keyup',function(e) {
            var start = this.selectionStart,
                end = this.selectionEnd;
            if (typeof iFileVal === 'undefined') return;
            if (iFileVal.length == 0) $('#iFile').val(this.value.replace(/[^\w+\/\.-]/g,''));
            this.setSelectionRange(start,end);
            e.preventDefault();
    

    I’m out of time today, but will try and spot the error in the regex as it does appear to have it in the replace values (/)

    Regards,
    Andy

    Regards,
    Andy
    http://www.thebmwz3.co.uk/
    https://github.com/andyb2000

    1 Reply Last reply Reply Quote 0
    • T
      Tom Elliott
      last edited by Jan 25, 2018, 4:10 PM

      This isn’t really a bug, per-say.

      People might actually want to store there images in sub directories. I don’t think the problem with ftp is because the / is a directory command, but rather that particular directory path does not exist and ftp can’t do the equivalent of mkdir -p.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      1 Reply Last reply Reply Quote 0
      • T
        Tom Elliott
        last edited by Jan 25, 2018, 4:11 PM

        And to help with the “where it’s going wrong” is it’s looking to replace when the length of the field is 0 (eg nothing typed in).

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • A
          andyb2000
          last edited by Jan 26, 2018, 8:23 AM

          Ah, thanks for the clarification @Tom-Elliott that makes sense, I just had some users complaining as they weren’t particularly linux-savvy trying to capture, not realising the significance of the forward slash.
          Thank you, I’ll advise them.

          Regards,
          Andy
          http://www.thebmwz3.co.uk/
          https://github.com/andyb2000

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator
            last edited by Jan 26, 2018, 11:39 AM

            Moved and marked as solved.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              4/5
              Last post

            199

            Online

            12.1k

            Users

            17.3k

            Topics

            155.4k

            Posts
            Copyright © 2012-2024 FOG Project