Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-33832

Check files.source field is set even in non-filepicker situations.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Files API, Repositories
    • Labels:
    • Testing Instructions:
      Hide

      With Javascript enabled:
      Create a folder resource and insert the following files:

      1.

      • upload a file
      • upload a file with a name conflict

      2.

      • pick file from Server files and insert it as copy
      • pick file from Server files and insert it as reference
      • pick file from Server files and insert it as copy with a name conflict
      • pick file from Server files and insert it as reference with a name conflict

      3. pick file from Private files

      4. pick file from Course legacy files

      5. pick file from Recent files

      6. repeat #2 for file from Dropbox

      7. pick file from Box.net

      8.

      • pick file from Wikimedia
      • pick file from Wikimedia with a name conflict

      you may try other repositories if you have time

      Save folder.

      Select from DB directly all files in this filearea, make sure the field source is filled human-readable in all cases and it is one of:

      • just filename in case of upload
      • "Admin user Private files: filepath" (in case of Private files)
      • "Server files: category/coursename/...." (in case of Server files and course legacy files)
      • something readable in case of Recent files (not that important actually)
      • full URL (for repositories that have public access to files)
      • repository name + path inside repository (for other external repositories)

      With Javascript disabled:
      Create a folder resource and

      • upload a file
      • upload a file with name conflict
      • pick a file from local repository
      • pick a file from local repository with name conflict
      • pick a file from external repository
      • pick a file from external repository with name conflict

      Save the folder
      Check the files.source field as described above

      Show
      With Javascript enabled: Create a folder resource and insert the following files: 1. upload a file upload a file with a name conflict 2. pick file from Server files and insert it as copy pick file from Server files and insert it as reference pick file from Server files and insert it as copy with a name conflict pick file from Server files and insert it as reference with a name conflict 3. pick file from Private files 4. pick file from Course legacy files 5. pick file from Recent files 6. repeat #2 for file from Dropbox 7. pick file from Box.net 8. pick file from Wikimedia pick file from Wikimedia with a name conflict you may try other repositories if you have time Save folder. Select from DB directly all files in this filearea, make sure the field source is filled human-readable in all cases and it is one of: just filename in case of upload "Admin user Private files: filepath" (in case of Private files) "Server files: category/coursename/...." (in case of Server files and course legacy files) something readable in case of Recent files (not that important actually) full URL (for repositories that have public access to files) repository name + path inside repository (for other external repositories) With Javascript disabled: Create a folder resource and upload a file upload a file with name conflict pick a file from local repository pick a file from local repository with name conflict pick a file from external repository pick a file from external repository with name conflict Save the folder Check the files.source field as described above
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      wip-MDL-33832-master

      Description

      From Marina in MDL-33513:

      I found that for some reason setting of files.source at
      https://github.com/moodle/moodle/blob/master/repository/repository_ajax.php#L269
      is included inside the different parts of "if" statement but not all.

      field source is set:

      • If file is picked by reference (from external or moodle repository) and there is no name conflict
      • If file is picked as copy from external repository

      field source is not set:

      • If file is picked by reference and there is a name conflict (user is asked whether to rename or overwrite an existing file);
      • If file is picked as a copy from internal moodle repository.

      Why don't we just set $record->source before this big "if" statement and it will be always consistent?

      And besides I don't see any usage of get_file_source_info() in non-js filepicker

      Again, I did not test it, this is just from code review.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12