Ignore:
Timestamp:
Apr 20, 2010, 11:14:00 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #3136 "slashes in magnet names" -- fixed in trunk for 2.00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/metainfo.c

    r10239 r10502  
    3535***/
    3636
     37char*
     38tr_metainfoGetBasename( const tr_info * inf )
     39{
     40    char *ret, *pch, *name;
     41
     42    name = tr_strdup( inf->name );
     43    for( pch=name; pch && *pch; ++pch )
     44        if( *pch == '/' )
     45            *pch = '_';
     46   
     47    ret = tr_strdup_printf( "%s.%16.16s", name, inf->hashString );
     48
     49    tr_free( name );
     50    return ret;
     51}
     52
    3753static char*
    3854getTorrentFilename( const tr_session * session,
    3955                    const tr_info *   inf )
    4056{
    41     return tr_strdup_printf( "%s%c%s.%16.16s.torrent",
    42                              tr_getTorrentDir( session ),
    43                              TR_PATH_DELIMITER,
    44                              inf->name,
    45                              inf->hashString );
     57    char * base = tr_metainfoGetBasename( inf );
     58    char * filename = tr_strdup_printf( "%s" TR_PATH_DELIMITER_STR "%s.torrent",
     59                                        tr_getTorrentDir( session ), base );
     60    tr_free( base );
     61    return filename;
    4662}
    4763
Note: See TracChangeset for help on using the changeset viewer.