Ticket #716: fix-permissions-after-transcode.patch

File fix-permissions-after-transcode.patch, 1.4 KB (added by Kushal Kumaran, 11 years ago)

Patch that fixes the permissions on transcoded videos and thumbnails

  • mediagoblin/media_types/video/processing.py

    diff --git a/mediagoblin/media_types/video/processing.py b/mediagoblin/media_types/video/processing.py
    index ff2c94a..7c45e30 100644
    a b  
    1515# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1616
    1717from tempfile import NamedTemporaryFile
     18import os
    1819import logging
    1920import datetime
    2021
    def sniff_handler(media_file, **kw):  
    5455    return False
    5556
    5657
     58def update_file_permissions(filename):
     59    m = os.umask(0)
     60    os.umask(m)
     61    os.chmod(filename, 0666 & ~m)
     62
     63
    5764def process_video(proc_state):
    5865    """
    5966    Process a video entry, transcode the queued media files (originals) and
    def process_video(proc_state):  
    117124
    118125            # Push transcoded video to public storage
    119126            _log.debug('Saving medium...')
     127            update_file_permissions(tmp_dst.name)
    120128            mgg.public_store.copy_local_to_storage(tmp_dst.name, medium_filepath)
    121129            _log.debug('Saved medium')
    122130
    def process_video(proc_state):  
    141149
    142150        # Push the thumbnail to public storage
    143151        _log.debug('Saving thumbnail...')
     152        update_file_permissions(tmp_thumb.name)
    144153        mgg.public_store.copy_local_to_storage(tmp_thumb.name, thumbnail_filepath)
    145154        entry.media_files['thumb'] = thumbnail_filepath
    146155